Object Definition Language - PowerPoint PPT Presentation

About This Presentation
Title:

Object Definition Language

Description:

Atomic types (e.g., string, integer, ...) Interface types (e.g., Person, Product, Company) ... OK: string, set of integer, bag of Address. Not OK: Product, set ... – PowerPoint PPT presentation

Number of Views:512
Avg rating:3.0/5.0
Slides: 11
Provided by: alon
Learn more at: https://www2.cs.uh.edu
Category:

less

Transcript and Presenter's Notes

Title: Object Definition Language


1
Object Definition Language
  • Is part of ODMG, which also gave us OQL.
  • Resembles C (and Smalltalk).
  • Basic design paradigm in ODL
  • Model objects and their properties.
  • For abstraction purposes
  • Group objects into classes.
  • What qualifies as a good class?
  • Objects should have common properties.

2
ODL Class Declarations
Interface ltnamegt attributes lttypegt
ltnamegt relationships ltrange typegt ltnamegt
methods Method example float gpa(in
Student) raises (noGrades) Arbitrary function
can compute the value of gpa, based on a student
object given as input.
3
ODL Example
category
price
Product
name
Company
Person
name
stockprice
name
address
ssn
4
ODL Declarations
Interface Product attribute string
name attribute float price
attribute enum Categories
electronics, communications, sports
category Interface Company
attribute string name attribute
float stockprice Interface Person
attribute integer ssn
attribute string name attribute
Struct Address string street, string city
address
5
ODL Example
category
price
Product
name
madeBy
buys
Company
Person
name
worksFor
stockprice
name
address
ssn
6
ODL Declarations
Interface Product attribute string
name attribute float price
attribute enum Categories
electronics, communications, sports
category relationship ltCompanygt
madeBy Interface Person
attribute integer ssn attribute string
name attribute Struct Address string
street, string city address
relationship set ltProductgt buys
relationship set ltCompanygt worksFor
7
ODL Example
category
price
Product
name
madeBy
makes
buys
Company
employs
Person
name
worksFor
stockprice
name
address
ssn
8
ODL Declarations
Interface Company attribute string
name attribute float stockprice
relationship set ltProductgt makes
inverse
ProductmadeBy relationship set
ltPersongt employs
inverse PersonworksFor
9
Types in ODL
Basic types Atomic types (e.g., string,
integer, ) Interface types (e.g., Person,
Product, Company) Constructors Set (1,
5, 6) Bag (1, 1, 5, 6, 6 ) List (1,
5, 6, 1, 6 ) Array Integer17
Struct string street, string city, integer
zipcode
10
Allowable Types in ODL
For attributes start with atomic or struct, and
apply a collection type. OK string, set
of integer, bag of Address. Not OK
Product, set of set of integer. For
relationships start with interface type
and apply a collection type. OK
Product, set of Product, list of Person.
Not OK struct pname Product, cname Company
set of bag of Product
integer
Write a Comment
User Comments (0)
About PowerShow.com