1 / 33

DBMS Lecture 9

DBMS Lecture 9. Object Database Management Group 12 Rules for an OODBMS Components of the ODMG standard OODBMS Object Model Schema OO Data Model Design Notation Oracle implementation of: Inheritance Aggregation. Rules that make it an OO system.

lieu
Download Presentation

DBMS Lecture 9

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. DBMSLecture 9 • Object Database Management Group • 12 Rules for an OODBMS • Components of the ODMG standard • OODBMS Object Model Schema • OO Data Model Design Notation • Oracle implementation of: • Inheritance • Aggregation

  2. Rules that make it an OO system • Complex objects must be supported - objects whose data type is more than simply the native data types of number, string, date • Object identity – all objects must have a unique identity that is independent of the values of its attributes i.e. objects are not identified by primary key values

  3. Rules that make it an OO system • Encapsulation must be supported i.e. access to an object is via its interface [cannot see the internal structure of an object or how its methods work] • Object classes the construct of object classes must be supported; the OODBMS schema must comprise a set of classes

  4. Rules that make it an OO system • Inheritance of methods and attributes must be supported • Dynamic binding the DBMS must bind method names to logic at run time [allows for methods to have the same name but apply to different objects and implement in different ways]

  5. Rules that make it an OO system • Complete DML should be a general purpose programming language • Extensible set of data types: the user must be able to build new data types from predefined types

  6. Rules that make it an OO system • Recovery facilities must be able to recover from hardware and software failure • Query management must provide a simple way of querying the data

  7. Rules that make it a DBMSIn an OODBMS • Data persistence: data must persist after the application has terminated and the user should not need to explicitly initiate persistence. • Capable of managing very large databases • Concurrent access must be possible

  8. Components of the ODMG [object database management group] standard 1 Object Model: a data model to be supported by ODMG compliant DBMS 2 Object specification language: • Object Definition Language [ODL] ODL used to define objects • Object Interchange Format [OIF] OIF used to upload and download object values to secondary storage

  9. Components of the ODMG [object database management group] standard 3 Object Query Language: a declarative language for querying the database - based on SQL3 4 Language bindings ability to read and write from a database using different programming languages

  10. Features of OODBM models • OODBM models real world entities as objects • Each object is composed of attributes and a set of methods • Each attribute can reference another object or set of objects • The attributes and the methods’ implementation are hidden, encapsulated from other objects

  11. Features of OODM models • Each object is identified by a unique object id (OID) which is independent of the values of its attributes • Similar objects are grouped in a class that contains a description of the attributes and methods • The class describes a type of object

  12. Features of OODM models • Classes are organized in a class hierarchy • Each object in a class inherits all properties of its superclasses in the class hierarchy

  13. OO data model Type Object Class Instance variable n/a oid method class hierarchy ER data model entity definition entity entity set attribute primary key n/a n/a ER diagram Comparing the OO and ER model Components

  14. Object Model:Objects • An object • instance of a class • has a unique identity • Property values • may have associated methods • Objects are defined against a type hierarchy: • Atomic [e.g. number, string, date] • Collection objects[ e.g. a set of students in a school]

  15. Object Model:Types • Class definition defines the abstract behaviour and abstract state of an object type • A type has a specification • operations that can be performed • and properties that can be accessed • ODMG model includes supertyping and subtyping and the associated notion of inheritance or a generalisation – specialisation relationship

  16. Object Model:Properties • Properties may either be an attribute of an object or a relationship between objects. • E.G. definition of attributes of a class: Module Attribute string moduleCode; Attribute string moduleName; Attribute short level; Attribute short roll;

  17. Object Model:Properties - relationships • E.G. Lecturer teaches Module, Module is taught by Lecturer are the 2 traversal paths for the relationship teaches. • E.G. A one to many relationship between a Lecturer type and Module type: CLASS Lecturer { RELATIONSHIP SET<module> Teaches INVERSE Module::TaughtBy; } CLASS Module { RELATIONSHIP Lecturer TaughtBy INVERSE Lecturer::Teaches; }

  18. Object Model:Operations • the behaviour of an object is defined by a set of operations [methods] associated with an object. • E.G. An operation to increase the roll of a module instance by a set amount VOID increaseRoll (IN SHORT amount);

  19. Object Model:schemas • Schemas : • database is defined by a schema specified in the object definition language. • schema information defined using ODL is stored in the system catalogue

  20. Example Object Model Schema for an academic Database

  21. Example Object Model Schema for an academic Database

  22. Example Object Model Schema for an academic Database

  23. OO Data Model Design Notation:Binary Relationships

  24. OO Data model Design Notation:Inheritance

  25. OO Data Model Design Notation:Aggregation

  26. OO Data Model Design Notation:Reference

  27. Implementing Inheritance in Oracle NOT INSTANTIATED

  28. Storing Objects in tables • Either a super type table or series of sub type tables CREATE TABLE persons OF person_typ (CONSTRAINT persons_pk PRIMARY KEY (id));

  29. Inserting data INSERT INTO persons VALUES(NEW employee1_typ(001, ‘bloggs’,’12-jun-2006’,12000,3000)); INSERT INTO persons VALUES(NEW student1_typ(001, ‘jones’,’12-jul-2006’,65));

  30. Retrieving objects from object tables: SELECT VALUE (p) FROM persons p;

  31. Example: Implementing Aggregation & Referencing in Oracle

  32. Implementing Aggregation & Referencing in Oracle

  33. workshop • Implementing an OO data model using SQL3 OO extension • Creating Object types • Creating tables for object types • Inserting data • Retrieving data

More Related