Presentation is loading. Please wait.

Presentation is loading. Please wait.

(Ref: ODMG2.0, R Cattell et al, Morgan Kaufmann, 1997)

Similar presentations


Presentation on theme: "(Ref: ODMG2.0, R Cattell et al, Morgan Kaufmann, 1997)"— Presentation transcript:

1 (Ref: ODMG2.0, R Cattell et al, Morgan Kaufmann, 1997)
CIS Fall ‘99 Handout 5a Notes on ODL (Ref: ODMG2.0, R Cattell et al, Morgan Kaufmann, 1997) CIS550 Handout 5a

2 ODL Object Definition Language (ODL): an object-oriented approach to database design A proposal from ODMG (somewhat volatile, and influenced by Java) Like the E-R model it starts from the premise that a database consists of objects (or entities) and relationships between objects (entities) CIS550 Handout 5a

3 ODL What are the objects (or observable entities) in my database?
How can “similar” objects be grouped together into classes? Objects are similar are they have the same properties: attributes (values of various types) relationships to other objects methods, or functions that can be performed on an object CIS550 Handout 5a

4 Interface Declaration
To specify a class, we use an “interface declaration” which describes the properties of object in the class. EXAMPLE: Airline Reservation Application Such an application might contain information about passengers and flights between various cities. The application is used to book reservations for passengers on flights, to determine the passenger list for a flight, etc. CIS550 Handout 5a

5 Example: Passengers class Passenger (extent passengers
key name, phone) { attribute string name; attribute string phone; attribute struct {string street, string city} address; struct {string number, date exp} credit-card; relationship SET<Flight> reservation method bool expired}; CIS550 Handout 5a

6 Example: Flights class Flight (extent flights,
key airline, flight-no,departure) { attribute string airline; attribute string flight-no; attribute Date departure; attribute Date arrival; relationship SET<Passenger> passenger-list method integer num-passengers}; CIS550 Handout 5a

7 Constraints on relationships
Inverse constraints. In our example, we would expect that if passenger X had a reservation on flight F, then X would be in the passenger-list for F. This is a many-many relationship SET<Flight> reservation interface Passenger … {... relationship inverse Flight :: passenger-list; …}; interface Flight … {… relationship SET<Passenger> passenger-list inverse Passenger :: reservation; …}; CIS550 Handout 5a

8 many-one: we could also model Planes as follows
Why not use an attribute? class Plane ...{ attribute string make; attribute integer model-no; attribute integer id-no; relationship SET<Flight> used-for;}; interface Flight ... { … relationship Plane equipment; …}; CIS550 Handout 5a

9 Attributes and Types E.g. if we were modeling a Book we might say
Unlike the relational model (atomic types), ODL types are built from atomic types, interface types, using type constructors Set<...>, Bag<...>, List<...>, Struct<...>. E.g. if we were modeling a Book we might say class Book … {... attribute List<string> authors; ...}; CIS550 Handout 5a

10 ODL: Subclasses class Person (extent persons key SS) {
attribute string name; attribute string SS}; class Male: Person { attribute integer num_tools; relationship Female wife inverse Female::husband}; class Female: Person{ attribute integer num_shoes; relationship Male husband inverse Male:: wife}: CIS550 Handout 5a

11 Differences between O2 DDL and ODL
ODL is based on Java/OMG IDL (mostly syntax) Following Java, one can also define interfaces. Extents are supported Keys are supported Inverse relationships are supported CIS550 Handout 5a


Download ppt "(Ref: ODMG2.0, R Cattell et al, Morgan Kaufmann, 1997)"

Similar presentations


Ads by Google