ObjectOriented Databases - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

ObjectOriented Databases

Description:

store and manage objects created by OOPL ... Can create both tables and objects. 27. Object-relational - ORDMS ... CREATE TYPE vehicle AS OBJECT (VID VARCHAR2 ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 36
Provided by: susanv5
Category:

less

Transcript and Presenter's Notes

Title: ObjectOriented Databases


1
  • Object-Oriented Databases
  • Chapters 21-22 as reference

2
 
  • Limitations to the relational model?
  • Examples of applications that will not work well
    with the relational model?

3
Shortcomings of DB models for
  • CAD/CAM - keep track of 1000's of matching parts
    and subassemblies
  • relational inefficient for this
  • object versioning
  • complex market-oriented operations (securities)
  • geographical information systems
  • CASE
  • OA (office automation)
  • multimedia databases
  • WWW

4
Different because of
  • requirements and characteristics that differ from
    traditional business applications
  • more complex structures for objects
  • new data types for storing images, text, user
    defined types
  • nonstandard application specific operations
  • stored procedures (also available now in some
    RDBS, such as ORACLE)

5
OODB systems
  • prototypes ORION, IRIS, ENCORE,
  • Commercial products ObjectStore, Versant,
    Objectivity/DB, Itasca (commercial version of
    ORION), POET
  • Open source object database
  • Postgres
  • Perst (McObject) supports SQL, ACID, etc.
  • Db4o queries only in Java, C, VB.NET
  • Magma Squeak (smalltalk-Gemstone)

6
OODB 
  • Some people felt the word object-oriented is too
    close to OOPL
  • ODB is more generic

7
Different approaches to designing ODB
  • 1. Applications written in extension of existing
    OOPL (1st generation OODB)
  • language, compiler, execution environment, etc.
    extended to incorporate 
  • DB functionality
  • store and manage objects created by OOPL
  • DB features such as transactions, concurrency
    control, etc.  
  • Selling point - unified programming and DB
    language but need query optimization, etc. 
  • Gemstone (Smalltalk), Poet (C)

8
Designing contd
  • 2. Extend relational DB to include OO
    features
  • OID, type hierarchy, inheritance, encapsulation,
    arbitrary data types, nested objects, etc.
  • Query language extended with programming
    capability
  • application communicates with DBMS through
    embedded query language calls in application
    program
  • Already familiar with DBMS but performance
    decreased  
  • Postgres - extended Ingres, Oracle

9
Designing contd
  • 3. Start entire process from scratch (next
    generation?)
  • unify relational and OO system  

10
Object Data Model
  • Bring concepts of OOPL into DB systems
  • Object corresponds to mini-world object
  • Object is data and behavior, object has
    attributes and operations
  • Data object has OID - immutable
  • Group data objects into classes - abstract
    mechanism, share same structure and behavior

11
ODM
  • Class has
  • instances
  • methods and data - encapsulation for information
    hiding - access only through methods
  • composite classes - composed of multiple types
  • Types vs. classes
  • nested objects - contains another object
  • complex objects - set of objects      
  • class hierarachy (ISA) specialization - define
    new classes from existing ones
  • inheritance of attributes and methods - reuse

12
ODM
  • Completeness
  • DBS needs to be computationally complete (Turing)
  • SQL not computationally complete - unless
    embedded SQL - impedance mismatch, since sets
  • connections with DML and OOPL in ODB more
    acceptable

13
ODM
  • Add features such as
  • concurrency
  • recovery
  • schema evolution
  • Versions
  • What about query language?
  • Performance?

14
ODM
  • Object identity OID
  • correspondence between mini-world and database
    objects
  • used to refer  to objects in application programs
    and in references between objects (relationships)
  • unique over entire DB and even over distributed
    DB

15
OID vs. primary key
  • identity based vs. value-based
  • unique over entire DB and even over distributed
    DB (if primary key changes, still same real-world
    object)
  • immutable - values of OID for object should not
    change
  • - OID not assigned to another object
  • - not dependent on any attribute
    values
  • - not use physical address      
  • system generated OID
  • not visible to user

16
OIDs in reality
  • in extended ODMSs, query language extended to
    allow access by OID
  • in OOPL, allow value based access by key
  • in Postgres - oid attribute in every tuple

17
Swizzling
  • All references in cached objects replaced with
    object's address
  • pointer to other memory resident objects -
    swizzling
  • saves OID lookup with subsequent references

18
Encapsulation
  • Encapsulation
  • information and operations, structure and
    behavior
  • implementation hidden
  • define behavior of object using operations
  • object accessible through predefined operations -
    methods
  • method invoked by sending messages
  • If query on attributes? SQL violates
    encapsulation

19
  Query Languge?OSQL Object SQL 
  • ODMG has provided standards for ODB just like
    relational databases.
  • Result is OSQL (object SQL)

20
Implementation Issues
  • pointer (OID) to nested object
  • nested - no joins needed
  • path queries instead of joins
  • when bring in an object into memory, bring in
    nested objects as well
  • replace OID with memory address (can't do this in
    relational)
  • eager and lazy swizzling
  • fast access - memory resident
  •  

21
Placing objects on disk?
  • clustering of objects
  • all of same class together
  • subclass follows superclass
  • nested objects
  • indexes for objects? (just like relations)
  • Views?

22
Performance
  • Performance of OODB affected by         cache
    sizes         clustering         indexes
            swizzling         replication

23
OODB issues
  • physical OODB design
  • clustering problems (NP-hard)
  • placing objects onto pages so number of page
    faults is minimal
  • user hints for clustering
  • where to stores objects, near related objects
  • how to store objects, near related objects

24
Example
  • Bob is a person, but also an employee
  •   store all persons then employee
  •   Bob Sally Joe Bill           Bob
  • if store employee attributes, must also retrieve
    information from person class

25
Example
  • Or can store all persons together, then students,
    then employees
  • person    students          employee
  • Bill        Sally Joe Bob      
  • Must retrieve all of them for person, and remove
    any extra attributes

26
Additional Topics
  • schema evolution?
  • Definition of class, changes to structure
  • views?
  • Extended relational
  • Now object-relational
  • Examine Oracle documentation to see how OO
    features included in 9i
  • Can create both tables and objects

27
Object-relational - ORDMS
  • Informix, IBM, Hewlett-Packard, Unisys, Oracle,
    and UniSQL
  • Extended relational" is probably the more
    appropriate term
  • ORDMSs specified by the extensions to the SQL
    standard, SQL3/4

28
ORDMS
  • Superset of RDMS
  • Definition?
  • Allows user defined types
  • User defined functions
  • Indexing/access methods to support them
  • ORDBMSs have had their greatest success in
    managing media objects and complex data such as
    geospatial and financial time series data
  • frequently used in Web applications and
    specialized data warehouses

29
Oracles object relational
  • Oracle ORDB
  • Relaxes 1NF
  • Has object types
  • Allows users to create
  • Types as objects
  • Object tables

30
Create type
  • Create type must be followed by a / in SQL Plus
    ( optional)
  • No objects created, like a struct type
  • // Create object type
  • Create type name_t as object
  • ( lname varchar(10),
  • fname varchar(10),
  • mi char(1) )
  • // Create relational table
  • Create table teachers
  • ( tid int,
  • tname name_t,
  • room int)

31
How to insert?
  • Can use object_type_name( ) form as an object
    constructor,
  • Builds objects from value of attributes
  • Insert into teachers values (1234, name_t(Sky,
    Sue, V), 120)

32
Path queries
  • Select t.tname.lname from teachers t where room
    120
  • // sometimes aliases are required
  • // best to always use

33
Create Object table
  • Create type person_t as object
  • (ssn int,
  • Pname name_t,
  • age int)
  • Create table people of person_t
  • //Can use value ( )
  • // The following are similar
  • Select value(p) from people p where age gt 25
  • Select from people where age gt 25

34
Inheritance
  • CREATE TYPE vehicle AS OBJECT
  • (VID VARCHAR2(20),
  • COLOR CHAR(10),
  • MAKE VARCHAR2(10),
  • MODEL VARCHAR2(10) ) NOT FINAL
  • CREATE TYPE car UNDER vehicle
  • ( DOORS NUMBER,
  • SPORT CHAR(1) )

35
Ref Object reference
  • Use REF keyword to point to a row object
  • Use dot notation to follow a REF to derefence a
    REF
  • If you want to query the OID use
  • Select REF(t) from toys t
  • How to insert tuples and query
  • Example of object-relational in Oracle
  •          
Write a Comment
User Comments (0)
About PowerShow.com