Presentation is loading. Please wait.

Presentation is loading. Please wait.

--The Object Database--1 The Object Database  Object databases integrate database technology with the object-oriented paradigm  In object databases,

Similar presentations


Presentation on theme: "--The Object Database--1 The Object Database  Object databases integrate database technology with the object-oriented paradigm  In object databases,"— Presentation transcript:

1 --The Object Database--1 The Object Database  Object databases integrate database technology with the object-oriented paradigm  In object databases, each entity of the real world is represented by an object. Classical examples of objects are:  Electronic components, designed using a Computer Aided Design (CAD) system;  Mechanical components, designed using a Computer Aided Manufacturing (CAM) system;  Specifications and programs, managed in a Computer Aided Software Engineering (CASE) environment;  Multimedia documents, which includes text, images and sound, managed by multimedia document managers.

2 --The Object Database--2 Non-1NF Date  Consider the table shown below. --------------------- ACME | part | place | ------|------ | liquor| Paris | engine| Paris | ----------|---------------- DELCO | part | place | ------|------ | engine| Rome....

3 --The Object Database--3 Un-nest and Normalise Table  The relational database solution - unnest   Normalize if necessary  ACME appears twice  What happened to structure? supplier | part | Place --------------------- ACME | liquor | Paris ACME | engine | Paris DELCO | engine | Rome....

4 --The Object Database--4 A Data Structures Solution  Imagine a nested record structure  Variable-sized records are difficult to maintain  How to select?  No tuples, so what is the key?  Pointers are memory-only, how to store? Supplier Parts-list Parts -------- --------- ------------------ |ACME | | part1 ------> | liquor | Paris | | | | | ------------------ | parts-----------> | | ------------------ | | | part2 ------> | engine | Rome | -------- ---------

5 --The Object Database--5 A Rectangle Data Type  Database stores rectangles as four points  What does the following query do? SELECT * FROM R, S WHERE NOT(R.upperLeftX > S.lowerRightX OR S.upperLeftX > R.lowerRightX OR R.upperLeftY < S.lowerRightY OR S.upperLeftY < R.lowerRightY);  What does the following query do? SELECT * FROM R, S WHERE rectangle.overlaps(R, S);

6 --The Object Database--6 Abstract Data Type (ADT)  SQL has limited data types  New data types are useful  Polygons  Images  Sounds  video  Data type needs specifications for  Structure  Operations  Implementation  Optimization, e.g., indexing

7 --The Object Database--7 O-O Concepts - Object  Object  A uniquely identifiable entity that contains both the attributes that describe the state of a ‘real world’ object and the actions that are associated with it.  Encapsulates state  Instance variables or attributes  Complete encapsulation – can’t look inside and access variables (public vs. private)  Encapsulates behavior  Operations  Signature (specification) vs. method (implementation)

8 --The Object Database--8 O-O Concepts, cont.  Method  Block of code  Object performs method on self  Constructor, destructor  Message  Communicates request to an object  Parameters can be passed  Class  Blueprint for object  An object is an instance of a class  Inheritance  Superclasses, subclasses, overloading

9 --The Object Database--9 Definitions  OODM A logical data model that captures the semantics of objects supported in object-oriented programming.  OODB A persistent, sharable collection of objects defined by an OODM.  OODBMS The manager of an OODB

10 --The Object Database--10 Why OODB?  From programming language point of view:  permanent storage of objects (languages just support objects in memory)  sharing of objects among programs  fast, expressive queries for accessing data  version control for evolving classes and multi-person projects

11 11 Why OODB?  From database point of view:  More expressive data types (traditional DBs provide limited predefined types) e.g., a desktop publishing program might model a page as a series of frames containing text, bitmaps, and charts need composite and aggregate data types (e.g., structures and arrays)  More expressive data relationships many-to-one relationship (e.g., many students in one class) navigating across relationship links  More expressive data manipulation SQL is relationally complete but not computationally complete i.e., great for searching for lousy for anything else –leads to use of conventional programming language plus SQL-interface –overhead of mapping from SQL to conventional languages Better integration with programming languages (esp. OO languages) Encapsulation of code with data

12 --The Object Database--12 Two Object-oriented Approaches  Object-oriented (OODBMS)  Hellerstein - “to add DBMS capabilities to an O-O language”  Persistence, object lives beyond program execution PJava - persistent Java Several commercial products  Object-relational (ORDBMS)  Hellerstein - “extends a relational database with O-O features”  Rich data types Inheritance Several commercial vendors, SQL3

13 --The Object Database--13 OODBMS  Advantages  Removes impedance mismatch  Long-lived transactions  Enriched modeling  Disadvanatages  Lack of universal query language  Lack of agreed upon standard  Performance depends on class definition

14 --The Object Database--14 ODMG 2.  Object Database Management Group  Consortium of Vendors: O2, ObjectStore, etc.  Standard for OODBMS Portability Interoperability Comparison Optimization  Object model  ODL  OQL

15 --The Object Database--15 Object Model  Atomic object  Any user-defined object  Class definition Properties (attributes and structure) (Binary) Relationships (to other objects) Operations  Collection object  Set, array, list, etc.  Built-in  Interface (virtual object)  Inheritance  Multiple inheritance only from interfaces

16 --The Object Database--16 Object Model, cont.  Extent – named, persistent collection of objects of the same class/type  One predefined extent for each class  Key  Unique for extent  Factory object  Constructor

17 --The Object Database--17 Example Class Person { extent persons key ssn } { attribute struct { string first, string last } name; attribute integer ssn relationship Factory worksIn inverse Factory::employeeOf relationship set parentOf inverse Person::childOf; relationship set childOf inverse Person::parentOf };

18 --The Object Database--18 Mapping EER to ODL  Entity type -> class definition  Attribute -> attribute Many-valued -> set attribute Composite -> struct attribute Key -> key  Weak entity type  Composite, multi-valued attribute in owning entity type  Alternative, map to class  Inheritance  Simple, use class inheritance

19 --The Object Database--19 Mapping EER to ODL, cont.  Relationship types  Binary (no attributes) Add relationship attributes to each side Use sets for many  Ternary or with attributes Map to separate class

20 --The Object Database--20 OQL  SQL-like  SELECT-FROM-WHERE  FROM clause is only major difference  Iterator variables p in Person Person p Person as p  Path expressions (can appear in any clause) “dot” notation p.ssn Value of attribute ssn in object denoted by iterator variable p Same notation for following relationships (few joins!) p.parentOf.ssn

21 --The Object Database--21 Examples  What are the social security numbers of people? SELECT s FROM person p, p.ssn s;  What are the social security numbers of children? SELECT s FROM person p, p.childOf.ssn s;  Alternatively SELECT s FROM person.childOf.ssn s;

22 --The Object Database--22 Examples  Create a structure for each social security number and last name of a grandchild whose first name is ‘Frank’. SELECT struct(last_name: g.name.last, ssn: g.ssn) FROM person p, p.childOf c, c.childOf g WHERE g.name.first = ‘Frank’;

23 --The Object Database--23 ORDBMS: Third Generation Manifesto  Rich type system  Inheritance is a good idea  Use primary key when available  Rules (triggers, constraints) are a major feature  Database access via SQL, usually embedded  SQL3  Parts have been released, Oracle supports some SQL3 features  Collections  Recursion

24 --The Object Database--24 SQL3 DDL  Example CREATE TABLE Student (name VARCHAR(30), image GIF, phone setof{INTEGER}, );  Phone is a set  GIF is a user-defined data type

25 --The Object Database--25 Multimedia databases  Types of multimedia data  Images  Audio  Video  Documents  Queries on multimedia data  While the coding of multimedia data is a general problem, the ability to query large amounts of multimedia data is a more specific problem of multimedia databases.  In general, it is possible to select a multimedia object only in probabilistic terms.


Download ppt "--The Object Database--1 The Object Database  Object databases integrate database technology with the object-oriented paradigm  In object databases,"

Similar presentations


Ads by Google