1 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Advanced Databases The ODMG Standard for Object Databases.

Slides:



Advertisements
Similar presentations
Why Object-Oriented DBMS? Abstract data types Interface with host programming language (the impedance mismatch). Object identity: (peter, 40, {(john, 15,
Advertisements

Advanced Database: Seminar # 12: Object-Oriented Databases1 Object Oriented Databases Seminar 12 Exploring ODMG - OQL Using Lambda-DB.
Object Databases Baochuan Lu. outline Concepts for Object Databases Object Database Standards, Languages, and Design Object-Relational and Extended-Relational.
ODMG Standard: Object Model1 OBJECT-ORIENTED DATABASE SYSTEMS ODMG Standard: Object Model Susan D. Urban and Suzanne W. Dietrich Department of Computer.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Object-Orientation in Query Languages By: Toan Nguyen Class: CS 157A.
Object-Oriented Standards OMG OMDG. Overview Object Management Group (OMG) International non profit-making consortium founded in 1989 to address object.
Programs with SQL Host language + Embedded SQL Preprocessor Host Language + function calls Host language compiler Host language program Preprocessor Host.
Object Oriented Databases - Overview
July 13, 2015ADBS: OODB1 Concepts for Object-Oriented Databases Chapter 20.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
1 Announcements Research Paper due Monday November 22.
Databases Illuminated Chapter 7 The Object-Oriented Model.
RIZWAN REHMAN, CCS, DU. Advantages of ORDBMSs  The main advantages of extending the relational data model come from reuse and sharing.  Reuse comes.
Chapter 4 Object and Object-Relational Databases (Part ½: Object-Oriented Concepts) Lecturer: H.Ben Othmen Department of Computer Science, Umm Al-Qura.
Object-Oriented Database Design using UML and ODMG
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
1 ODB Design: Handling Associations and Inheritance in ODL M. Akhtar Ali School of Informatics.
Object and object-relational databases 1. Object databases vs. Object-relational databases Object databases Stores complex objects – Data + functions.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Chapter 24 Introduction to Object DBMSs Prepared by Kai Huang CS157B Prof Sin-Min Lee.
Object Query Language (OQL) and Language Binding
Agenda  TMA03  M877 Block 3 Databases with Objects.
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
ORDBS1 Object Relational Database Systems: 1. Introduction 2. Objects in SQL3 3. Comparison of ODL/OQL and SQL3 Approaches CIS 671.
Why Object-Oriented DBMS? Abstract data types (relational data model is too simple). Interface with host programming language Managing large number of.
Chapter 21 A Object Data Model - Intro Copyright © 2004 Pearson Education, Inc.
Chapter 2: Object Model Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National Univ.
8 October, 2001DBIS4 - RLC108 Object Query Language The need for ad hoc querying What SQL does What OQL must do OQL syntax and examples.
Object oriented databases
1 Advanced Databases – Lecture # 11 Object-Oriented Databases Advanced Databases Object Oriented Databases School of Informatics Akhtar Ali.
Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)
Chapter 21 Object Database Standards, Languages, and Design Copyright © 2004 Pearson Education, Inc.
1 Advanced Databases (CM036) – Lecture # 12: The ODMG Standard for Object Databases Object Query Language (OQL) & Language Binding Advanced Database Technologies.
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
1 CS457 Object-Oriented Databases Chapters as reference.
Scaling Heterogeneous Databases and Design of DISCO Anthony Tomasic Louiqa Raschid Patrick Valduriez Presented by: Nazia Khatir Texas A&M University.
Databases Illuminated
CSE 6331 © Leonidas Fegaras OODB1 Object-Oriented Databases and the ODMG Standard.
OODBMS: Introduction and Logical Database Design
11-1 CHAPTER 11 Concepts for Object-Oriented Databases.
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
AND OBJECT-ORIENTED DATABASES OBJECT-RELATIONAL DATABASES.
The ODMG Standard for Object Databases
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
OOPSLA Lab.1 Chapter 6 Smalltalk Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Advanced Database: Seminar # 12: Object-Oriented Databases1 Object Oriented Databases Seminar 12 Exploring ODMG standard Using Lambda-DB.
1 ODB Design Handling Inheritance in ODL M. Akhtar Ali School of Informatics.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
1 ODMG. 2 Object Database Management Group (ODMG) ODMG has been formed in late 1991 by: ObjectDesign, Ontos, O2 Technology, Versant, Objectivity, Digital.
1 ODMG: ODL and OQL This lecture is a short version of: Lecture 11 (on ODL) & Lecture 12 (on OQL) M. Akhtar Ali School of Informatics.
Object-Oriented Databases (chapter 3/3) ODMG-OQL for querying the database Simple OQL Queries, Retrieving Objects – an example Database Entry Points Retrieving.
OOPSLA Lab1 Chapter 7 Java Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Object-Oriented Databases (chapter 2/3) Object Persistence - Introduction Persistent Programming Languages Specifying Object Persistence via Naming and.
Why Object-Oriented DBMS?
Object-Oriented Databases and the ODMG Standard
Advanced Databases Object Oriented Databases
OBJECTS & DATABASES Arnaud Sahuguet – CIS-550.
Object-Oriented Databases
Chapter 12 Outline Overview of Object Database Concepts
Lec 3: Object-Oriented Data Modeling
ISC321 Database Systems I Chapter 10: Object and Object-Relational Databases: Concepts, Models, Languages, and Standards Spring 2015 Dr. Abdullah Almutairi.
ODB Design: Handling Associations and Inheritance in ODL
Object Databases: Logical Data Modeling
ITEC 3220A Using and Designing Database Systems
Chapter 15: Object-Oriented Database Development
Presentation transcript:

1 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Advanced Databases The ODMG Standard for Object Databases

2 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases ODMG 3 Object Database Standard Object Database Management Group, formed 1991, intended to: –provide a standard where previously there was none –support portability between products –move away from single language systems –standardize model, querying and programming issues Enables both designs and implementations to be ported between compliant systems Currently on version 3.0 Most vendor products are moving toward compliance; O2 is possibly the closest Vendors: Object Design,Objectivity, O2 Technology, POET, etc. URL:

3 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases ODMG Components An architecture for OODBMS. An object model. –that will act as the logical model for all OODBMS and provide a level of interoperability. A data definition language (ODL). –a concrete specification of the operations permitted over a schema defined in the data model. A query language (OQL). –for posing ad-hoc queries but not for data definition or data manipulation. Language bindings to existing OOPL, (C++, Java, Smalltalk). –the object manipulation languages are the integration of a PL with the ODMG model, so the OOPL’s get persistence and the OODB gets a flexible and standard DB programming language.

4 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases An Architecture for OODBMS

5 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Object Model 1. Data Model –state and structure of data 2. Behaviour model –dynamics of the data –operations on the data 3. Persistence model –the way the persistent and transient data is created & changes status 4. Naming model –naming and accessing objects Object identity Complex objects Types and classes Inheritance hierarchies Encapsulation Late binding/overriding Extensibility Completeness

6 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Object Identity An object’s unique identifier maintained throughout the object’s lifetime Not user visible System generated An object has an existence independent of its value (identity vs equality) thus implying –object sharing –object updating –supports referential integrity Objects can be cyclic JohnMary Susan Children: Name: Age: School: Susan The composition graph is an object network

7 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases ODMG Model supports databases... Built-in structured types which permit traditional database modelling to be used –Objects and Literals (atomic and complex) –Relationships and Attributes Transactions –nested transactions, where transaction semantics only apply to persistent data Databases –built-in object types for databases, schemas and sub-schemas Persistence –lifetime of object specified when created Names –handles by which persistent information can be accessed

8 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Objects, Literals and Mutability Objects –are addressed through an object identifier –are instances of classes –are packaged structures –can be shared –will be stored separately—the oid will be stored in the containing structure –properties have different levels of visibility –new operations can be user- defined for classes –mutable (components can be updated but it remains as the same object) –can be arranged into hierarchies name address name address house street Carole Ian 3 Arcacia Ave age 21 age 47

9 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Objects, Literals and Mutability name address house street Carole 3 Arcacia Ave Literals –do not have an identity: are addressed by a physical address –are instances of types –are simple structures –are not shared –will be embedded in any containing structure –properties are all public –no methods can be defined against types –immutable (the value is the identity, so if one of the components change its a different value) –can’t be arranged into hierarchies age 21 name address house street Ian 3 Arcacia Ave age 47

10 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Complex Objects Atomic built-in literal types: –long, short, unsigned long, unsigned short, float, double, string, boolean, char, any, octet The simplest objects are made up of these atomic types Complex objects are built from simple ones by applying type constructors which can be nested Type constructors –collections –record structures Person: <oid:#2, name:Henah, address: “Heaton”, birthDate: 12/02/1990> employee: <oid:#18, name:Neil, address:”Newcastle”, birthDate: 23/09/1970, children: set(#2, #3), dept:#100, manager:#19>

11 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Object Types, Collections, Structures Object Types –interface: specifies abstract behaviour of objects Instances of an interface cannot be created. –class: specifies state and behaviour of objects Instances of a class can be created. Collection types –set (unordered collection without duplicates) –bag (unordered collections with duplicates allowed) –list (ordered collection with duplicates allowed) –array ( indexed lists, ordered, of fixed size) –dictionary (unordered, variable size, direct access) –enumerations (explicitly listed group of values, “Mr”, “Ms”) Record types –struct (tuple) struct Address { unsigned short house, string street, set residents }

12 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Attributes and Relationships Attributes –Unidirectional –Values could be literals and objects –Single as well as multi- valued Relationships –Implicitly modelled as properties whose values are objects –Frequently bidirectional –Bidirectional relationships require inverses –1:many, 1:1, many:many Resort Hotel name location beachType numberOfBeaches transferTime addFacility(F) isChildFriendly(): B checkAvailability(S,R) name address numberOfRooms isOverBooked addFacility(F) showHotels(): set(H) * 1 hotels resort

13 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Inheritance Classes are organized into inheritance hierarchies –The properties and operations of an object type are inherited by its subclasses and so only need to be written once. Saves code through reuse Makes code simpler Provides a compact, well structured and easy to understand Two kinds of inheritance supported: –Inheritance of Behaviour or ISA –Inheritance of State Inheritance of behaviour denoted by “:” interface Person {…}; class Student : Person {…}; Inheritance of state denoted by “extends” class Vehicle {…}; class Car extends Vehicle {…};

14 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Object Definition Language (ODL) ODL is a specification language used to define the schema of an ODMG compliant database. ODL supports all semantic constructs of the ODMG object model. ODL is independent of any programming language, and hence provides means for the portability of database schema across complaint OODBMSs. The database schema may comprise of: –an ODL module (i.e. a higher level construct for grouping ODL specifications), –some generic object types using interface, –some concrete object types using class, and –some literal types using struct, etc.

15 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases University schema in ODL class Student extends Person (extent Students) { attribute string major; relationship Lecturer tutor inverse Lecturer::tutees; relationship Course enrolledOninverse Course::hasStudents; relationshipset takesinverse Unit::takenBy; boolean register(in Course C); boolean takeUnit(in Unit U); }; class Lecturer extends Person (extent Lecturers) { attribute short room; relationship set tutees inverse Student::tutor; relationship Department worksFor inverse Department::staff; relationship set teaches inverse Unit::taughtBy; boolean teachUnit(in Unit U); }; class Person { attribute string name; attribute string address; attribute date birthDate; short age(); };

16 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases University schema in ODL – cont … class Course (extent Courses) { attribute string name; relationship Department offeredByinverse Department::offers; relationship set hasStudentsinverse Student::enrolledOn; relationship set hasUnitsinverse Unit::partOf; }; class Department (extent Departments) { attribute string name; relationship set staffinverse Lecturer::worksFor; relationship set offers inverse Course::offeredBy; }; class Unit (extent Units) { attribute string name; attribute string code; relationship set takenBy inverse Student::takes; relationship set taughtByinverse Lecturer::teaches; relationship set partOfinverse Course::hasUnits; };

17 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases OQL – for querying the database OQL is the the query language in ODMG standard. OQL is a superset of the SQL (in select-from-where clauses). It can be interactive as well as embedded in other programming languages. It is a declarative language. OQL can invoke operations written in programming languages (C++, Java, Smalltalk). The operators in the language can be freely composed. OQL includes operators for creating collections, arithmetic and logical operators, aggregation, sorting and grouping.

18 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Retrieving Objects select l from l in Lecturers where l.address = “Newcastle” or select l from Lecturers as l where l.address = “Newcastle” or select l from Lecturers l where l.address = “Newcastle” The query returns all Lecturer objects who live in Newcastle. The type of the query result is bag. Whenever the scope of an OQL query is a collection (e.g. Lecturers, a set of Lecturer objects), we define an iterator variable that ranges over the collection (e.g. l in Lecturer ). In the query l denotes an object of type Lecturer.

19 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Database Entry Points Named objects are entry points to the database (same as table or view names in RDBs). Class extents are usually used to refer to in OQL queries. Some frequently used objects can be assigned unique names e.g. ComMath a named Department object or AdvDB as named Unit object. To use named objects, you don’t have to write a query in select-from-where form. You can simply write: ComMath.staff which returns all staff member objects in the school of computing and mathematics. Students which returns a set of all Student objects in the database.

20 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Retrieving data from multiple objects Without using Joins select struct(LName:l.name, DName:l.worksFor.name) from l in Lecturers –The query contains an implicit join based on the relationship that exists between Lecturer and Department object types and due to the path expression l.worksFor.name. However, the user does not need to tell the OQL compiler. Using Joins select struct(LName:l.name, DName:d.name) from l in Lecturers, d in Departments where l.worksFor = d –Here the user explicitly tells that a join should be performed on the basis of matching OIDs (l.worksFor and d denote an OID of a Department object).

21 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Unnesting and Nesting Collections Unnesting a collection select struct(LName:l.name, SName:s.name) from l in Lecturers, s in l.tutees –The query retrieves names of lecturers and their tutees in pairs. –The query iterates over the collection Lecturers via the variable l; then iterates over l.tutees (a set of Student objects) via the variable s; then projects out name from l and name from s. The type of the query result is bag. Nesting a collection select struct(LName:l.name, SNames:(select s.name from s in l.tutees) from l in Lecturers –The query retrieves for every lecturer, his/her name and all his/her tutees names. –Here instead of unnesting l.tutees, the query iterates over l.tutees via s and projects out name attribute and then constructs a collection out of it. The type of the query is bag >.

22 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Language Binding Extends an OOPL (C++, Java, Smalltalk) with ODL and OML (Object Manipulation Language) for building OODB applications. ODL binding defines how ODL constructs are mapped onto an OOPL. OML binding defines how objects are created, deleted, and modified in an OOPL. An OOPL may embed OQL where results returned by OQL queries can be manipulated by OOPL.

23 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases C++ ODL class Department (extent Departments) { attribute string name; relationship set staff inverse Lecturer::worksFor; relationship set offers inverse Course::offeredBy; }; ODLODL const char _worksFor[ ] = “worksFor”; const char _offeredBy[ ] = “offeredBy”; class Department : d_Object {public: d_String name; d_Rel_Set staff; d_Rel_Set offers; }; d_Extent Departments(DB1); // for extent // DB1 is the database name C++C++ for inverse relationships

24 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases C++ OML Object Creation d_Ref S = new(DB1, “Student”) Student; // creates a new Student object in DB1 database d_Ref L = new(DB1, “Lecturer”) Lecturer; // creates a new Lecturer object in DB1 database Object Modification S->name = “Richard Spring”; // modifies name attribute of Student S S->address = “Durham”; // similarly L->room = 103; // modifies room attribute of Lecturer L L->tutees.insert_element(&S); // establishes a relationship // between Lecturer L and Student S Object Deletion L.delete_object(); // deletes the Lecturer object from the database

25 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases C++ OQL Define variables for the query result d_Bag > ComMathStaff; d_Bag > ToonArmy; Create an instance of type d_OQL_Query d_OQL_Query q (“select l from l in Lecturers where l.worksFor.name = $1); d_OQL_Query q1 (“select s from s in Students where s.address = “Newcastle”); Modify the query with Parameters q << “Computing and Maths”; // Imposes a restriction on the query Execute the query d_oql_execute(q, ComMathStaff); // executes the query q and stores the result into ComMathsStaff variable d_oql_execute(q1, ToonArmy); // executes the query q1 and stores the result into ToonArmy variable

26 Advanced Databases – Lecture # 12: The ODMG Standard for Object Databases Summary An overview of ODMG standard An introduction to the Object Data Model A little bit of ODL Introduction to OQL Introduction to language binding