Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)

Similar presentations


Presentation on theme: "Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)"— Presentation transcript:

1 Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)

2 Database Management COP4540, SCS, FIU Object-oriented database systems New data types and classes are introduced –Record Structure, collection type, reference type –Class hierarchies and inheritance Data are grouped in objects –Object Identity (OID) Why object-oriented? –More powerful expressiveness –High reusability of schemas –Less misuse of data

3 Database Management COP4540, SCS, FIU ODMG Standard ODMG (Object Data Management Group) –A consortium of OODBMS vendor Several parts –Object Model –Object Definition Language –Object Query Language –Binding to OO programming language

4 Database Management COP4540, SCS, FIU Overview of Object Model (1) Objects and Literal –Basic building blocks of the object model. –The key difference: Object Identifier. Built-in Interface for Collection Objects –Set no multiple occurrence allowed –List the order is important –Bag multi-set –Array the size is fixed –Dictionary a collection of association pairs

5 Database Management COP4540, SCS, FIU Interface, Classes, and Inheritance –The similar concept can be found in C++/JAVA. –Interface: non-instantiable –Class:instantiable –Question: what are the corresponding concepts in C++ and Java? –Inheritance Behavior inheritance: supertype should be an interface. EXTENDS: both supertype and subtype must be classes. Multiple inheritance is allowed only for behavior inheritance. Overview of Object Model (2)

6 Database Management COP4540, SCS, FIU Extents, Keys –declare an extent for any object type that is defined via a class declaration, and it will contain all persistent objects of the class. –Extents are also used to automatically enforce the set/subset relationship between the extents of a supertype and its subtype. –A class with an extent can have one or more keys. Simple key composite key (compound key). Overview of Object Model (2)

7 Database Management COP4540, SCS, FIU Object Definition Language (ODL) A proposed standard language for specifying the structure in OO terms. It is independent of any particular programming language. An extension to IDL, which is a component of CORBA. A kind of data definition language at conceptual level. Abstract ODL Relational Design C++ Smalltalk RDBMS C++ Based OODBMS Smalltalk-Based OODBMS

8 Database Management COP4540, SCS, FIU Basic Declarations in ODL ODL class declarations class (extent key … { }; Element declarations attribute ; relationship ;

9 Database Management COP4540, SCS, FIU Relationships in ODL A way to connect objects in the database, either from same class or different classes. Inverse relationship Multiplicity of relationships –one to one –many to one (one to many) –many to many

10 Database Management COP4540, SCS, FIU Method Example float gpa (in: Student) raises (noGrades) float = return type in: indicate Student argument is read-only –Other options: out, inout noGrades is an exception that can be raised by method gpa.

11 Database Management COP4540, SCS, FIU Types in ODL Basic types –integer, real/float, string, enumerated types and classes. Type constructors –Four basic collection types: Set:Set Bag:Bag List:List Array:Array –Struct for Structures: Struct N { T 1 F 1, T 2 F 2, …, F n T n )

12 Database Management COP4540, SCS, FIU Additional Notes on Types Structured types have names and bracketed lists of field-type pairs. Enumerated types have names and bracketed lists of values. An element from another class is indicated by: ::

13 Database Management COP4540, SCS, FIU Additional Notes on Types Limitation on nesting class Relationship collection Attribute basic, no class struct collection

14 Database Management COP4540, SCS, FIU An Example class Beers (extent all_beers) { attributestring name; attributestring manufacturer; attribute integer price; relationship set servedAt inverse Bar::serves; relationship set fans inverse Drinkers::likes; }; class Bars (extent all_bars) { attributestring name; attributestruct Add {string street, string city, integer zip} address; attribute enum Lic {full, beer, none} licenseType; relationship set customers inverse Drinkers::frequents; relationship set servers inverse Beers::servedAt; }; class Drinkers (extent all_drinkers) { attributestring name; attributestruct Bars::Addr address; relationship set likes inverse Beers::fans; relationship set frequents inverse Bars::customers; };

15 Database Management COP4540, SCS, FIU Another Example class Person (extent persons key ssn) { attributestruct Pname {string fname, string lname, string lname} name; attributestring ssn; attribute date birthdate; attributeenum Gender{F, M} sex; abbribute struct Add {short no, string street, short aptno, string city, string state, short zip} address; short age(); }; class Student extends Person (extent students) { attributestring class; relationship Department majors_in inverse Department::has_majors; voidchange_major(in string dname) raises(dname_not_valid) };


Download ppt "Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)"

Similar presentations


Ads by Google