1 / 15

Database Modeling

Database Modeling. A Introduction to object definition language (ODL). 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)

finna
Download Presentation

Database Modeling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database Modeling A Introduction to object definition language (ODL)

  2. 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. 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. 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<T> no multiple occurrence allowed • List<T> the order is important • Bag<T> multi-set • Array<T> the size is fixed • Dictionary<K, V> a collection of association pairs

  5. Overview of Object Model (2) • 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.

  6. Overview of Object Model (2) • 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).

  7. 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. Relational Design RDBMS Abstract ODL C++ C++ Based OODBMS Smalltalk Smalltalk-Based OODBMS

  8. Basic Declarations in ODL • ODL class declarations class <name> (extent <name> key <attirbute>… { <list of elements = attributes, relationships, methods> }; • Element declarations attribute <type> <name>; relationship <rangetype> <name>;

  9. 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. 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. Types in ODL • Basic types • integer, real/float, string, enumerated types and classes. • Type constructors • Four basic collection types: • Set: Set <T> • Bag: Bag <T> • List: List <T> • Array: Array <T> • Struct for Structures: • Struct N { T1 F1, T2 F2, …, Fn Tn)

  12. 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: <class>::

  13. Additional Notes on Types • Limitation on nesting Relationship class collection Attribute basic, no class struct collection

  14. An Example class Beers (extent all_beers) { attribute string name; attributestring manufacturer; attributeinteger price; relationshipset <Bars> servedAt inverse Bar::serves; relationshipset<Drinkers> fans inverse Drinkers::likes; }; class Bars (extent all_bars) { attribute string name; attributestruct Add {string street, string city, integer zip} address; attributeenum Lic {full, beer, none} licenseType; relationshipset<Drinkers> customers inverse Drinkers::frequents; relationshipset<Beers> servers inverse Beers::servedAt; }; class Drinkers (extent all_drinkers) { attribute string name; attribute struct Bars::Addr address; relationshipset <Beers> likes inverse Beers::fans; relationshipset<Bars> frequents inverse Bars::customers; };

  15. Another Example class Person (extent persons key ssn) { attributestructPname {string fname, string lname, string lname} name; attributestring ssn; attributedate 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) { attribute string class; relationship Department majors_in inverse Department::has_majors; void change_major(in string dname) raises(dname_not_valid) };

More Related