Odl
Odl
ODMG
ODL OQL
(design (queries
Relational design
ODL
OODMBS input
ODL
Class Declarations
interface < name > {elements = attributes, relationships,
methods }
Element Declarations
attribute < type > < name > ;
relationship < rangetype > < name > ;
Method Example
float gpa(in: Student) raises(noGrades)
float = return type.
in: indicates Student argument is read-only.
Other options: out, inout.
noGrades is an exception that can be raised by method gpa.
Banking Example 1
Belongs-to
Customer-of branch
branchid location
Relationship
class collection
Attribute
interface employee {
attribute string name;
relationship Set<Employee> manager
inverse Employee::worker;
relationship Set<Employee> worker
inverse Employee::manager
}
manager
employee works for
worker
Subclasses in ODL
Subclass = special case = fewer
entities/objects = more properties.
Example: Faculty and Staff are subclasses of
Employee. Faculty have academic year (9
month salaries) but staff has a full-year (12
month salary).
ODL Subclasses
Follow name of subclass by colon and its superclass.
interface Faculty:Employee {
attribute real academic-year-salary;
}
Objects of the Faculty class acquire all the attributes
and relationships of the Employee class.
Inheritance in ODL and ER model differ in a subtle way
in ODL an object must be member of exactly one class
in ER an object can be member of more than one class
Keys in ODL
Indicate with key(s) following the class name,
and a list of attributes forming the key.
Several lists may be used to indicate several alternative keys.
Parentheses group members of a key, and also group key to
the declared keys.
Thus, (key(a1; a2; : : : ; an )) = “one key consisting of all n
attributes." (key a1; a2; : : : ; an ) =“each ai is a key by itself.
Keys are not necessary for ODL. Object identity and not
keys differentiates objects