1 / 16

Object Databases

Object Databases. Advanced Database Systems Dr. fatemeh Ahmadi- abkenari SEPTEMBER 2013. Limitations of Relational Data Model. Blob. - Video - DNA Sequences - VLSI Chip designs. Binary Large Object. Examples. MOVIE (Name: String, Director: String, Video: blob). SELECT M. Director

blogan
Télécharger la présentation

Object Databases

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. Object Databases Advanced Database Systems Dr. fatemeh Ahmadi- abkenari SEPTEMBER 2013

  2. Limitations of Relational Data Model Blob - Video - DNA Sequences - VLSI Chip designs Binary Large Object Examples MOVIE (Name: String, Director: String, Video: blob) SELECT M. Director FROM MOVIE M WHERE M. Name = ‘ John Smith’ Huge Overhead 1 Only with Specialized operation for a special Blob type e.g. frameRange (from, to) ? 2 Frames between 20000 and 50000 Burdening the database

  3. Limitations of Relational Data Model Person IsA Hierarchies Student PERSON (Name: String, SSN: String) ER or UML extract STUDENT (SSN: String, Major: String) Reject by SQL-92 No explicit presence of Name attribute SELECT S. Name FROM STUDENT S WHERE S. Major = ‘CE’ SELECT P. Name FROM PERSON P, STUDENT S WHERE P.SSN=S.SSN AND S. Major = ‘CE’ No E-R or UML based query language More Complex

  4. Limitations of Relational Data Model Impedance mismatch in database languages • Database applications are written in host languages such as C or Java • - Databases are accessed by executing SQL Fact - SQL is a set oriented language and returns a set of tuples. - Host languages do not support high level operations on relations. - Host Languages are of procedural nature (how) while SQL is of declarative nature (what). Problems

  5. Limitations of Relational Data Model Relational data model is unable to handle set-valued attributes in natural way. An inevitable redundancy is a result. Set-valued attributes PERSON (SSN: String, Name: String, PhoneN: String, Child: String ) If a person has several PhoneN and several Children Not in Third Normal Form SSN Name

  6. Limitations of Relational Data Model Set-valued attributes PERSON (SSN: String, Name: String, PhoneN:{String}, Child: {String}) Represents set-valued attributes Examples (111-22-3333, Joe Public, {516-123-4567, 516-345-6789}, {222-33-4444, 333-44-5555}) If the type of Child attribute were {PERSON} rather than {String}

  7. Conceptual Object Data Model (CODM) Classes Similar Objects are organized into Classes Classes play the same role in CODM that Relations play in Relational Databases. In SQL-92 a Database is a set of Relations and each Relation is a set of Tuples. In CODM a Database is a set of Classes and each Class is a set of Objects. A Class has a Type , a Method Signature (a schema) and an Extent. The Method Implementation is not part of CODM. In Object Data Model, two classes can have the Sub/Super Class Relationship or IsA Relationship.

  8. Conceptual Object Data Model (CODM) Terminology Declarations of operations that can be applied to the objects in a class Extent of a Class Type of a Class The set of all objects in a class Method Signature of a Class The common structure of all objects in a class (the collection of types of its components)

  9. Conceptual Object Data Model (CODM) Objects and Values Arrays List Structures, … (# 32, [ SSN:111-22-3333, Name: Joe Public, Phone: {“516-123-4567”, “516-345-6789”}, Child: {#445, #73}] ) In ODMG Complex Values oid (Object ID) • The Value part: • Primitive value (A member of Integer, String, Float, …) • Reference value (An oid of an object) • Tuple value: [A1:v1, … , A2:v2] • Set value: {v1, v2}

  10. Conceptual Object Data Model (CODM) Tuple types [ SSN: String, Name: String, Address: [StNumber: Integer, StName: String]] Tuple values exists in relational data model only at top (row) level. In CODM, they can appear at any level.

  11. Objects in SQL 1999/2003 Row Types ROW Type Constructor for construction of a tuple type CREATE TABLE PERSON ( Name CHAR (20), Address ROW (Number INTEGER, Street CHAR (20), ZIP CHAR (5) ) SELECT P. Name FROM PERSON P WHERE P. Address. ZIP=‘11987’ Referring tuple types: Path Expression for SELECT ROW Value Constructor INSERT INTO PERSON (Name, Address) VALUES (‘John Doe’ , ROW (666, ‘York Ville’, ‘55555’)) Updating tuple types UPDATE PERSON SET Address = ROW (21, ‘Shepard Ave’ , ‘12345’) WHERE Address = ROW (666, ‘York Ville’, ‘55555’) AND Name = ‘John Doe’

  12. Objects in SQL 1999/2003 User-Defined Types (UDT) Abstract data type CREATE TYPE PERSONTYPE AS ( Name CHAR (20), Address ROW (Number INTEGER, Street CHAR (20), ZIP CHAR (5) ) CREATE TYPE STUDENTTYPE UNDER PERSONTYPE AS ( Id INTEGER, Status CHAR (2) ) METHOD award_degree () RETURNSBOOLEAN; CREATEMETHOD award_degree () FORSTUDENTTYPE LANGUAGE C EXTERNAL NAME ‘file:/…/…/award_degree’;

  13. Objects in SQL 1999/2003 Using User-Defined Types CREATE TYPE TRANSCRIPT ( Student STUDENTTYPE, CrsCode CHAR(6), Semester CHAR (6), Grade CHAR(1) ) Adding Objects INSERT INTO TRANSCRIPT (Student, Course, Semester, Grade) VALUES (NEW StudentType() .Id (987676767) . Status (‘H5’) . Name (‘John Smith’) . Address (ROW (456, ‘Florida Ave’, ‘5454545’)), ‘ADS’, ‘F911’ ‘A’)

  14. Objects in SQL 1999/2003 Reference Types CREATE TABLE TRANSCRIPT1 ( Student REF (STUDENTTYPE) SCOPE STUDENT2 , CrsCode CHAR(6) , Semester CHAR (6) , Grade CHAR (1) ) Querying reference types SELECT T. Student -> Name, T. Grade FROM TRANSCRIPT T WHERE T. Student ->Address. Street = ‘ Shepard Ave’

  15. Objects in SQL 1999/2003 Inheritance CREATE TYPE STUDENTTYPE UNDER PERSONTYPE AS ( Id INTEGER, Status CHAR (2) ) 1 A supertable for table STUDENT 2 CREATE TABLE STUDENT OF STUDENTTYPE UNDER PERSON • In order for a table T1 to be a subtable of another table T2 the following must hold: • The UDT of T1 must be a subtype of (defined as being UNDER) the UDT of T2. • The table T1 must be defined as being UNDER the table T2.

  16. OQL: The ODMG Object Query Language Methods in OQL MOVIE (Name: String, Director: String, Video: blob) SELECT M. frameRange (100, 1000) FROM MOVIE M WHERE M. Name = “Film1” Methods can be invoked in SELECT statement SELECT P. add_ phone_ number (“555-1212”) FROM PERSONEXT P WHERE P. SSN = “123-45-6789 ” This query changes the database but does not return anything to the caller. The ability to call update methods in the OQL SELECT statement blurs the boundary between the data manipulation and query language.

More Related