OODB_Intro1.htm
Object Oriented Database:
  • This document is far from coaching object oriented relational model of DBMS; but created with an intention to introduce the essence of  "Object-Relational-Databases".
  • Objects were one of the new features of Oracle-8, evolved through Oracle-7
References :
 Object definition: An object is an abstract entity, which has unique identity, properties and ability to interact with other objects.

Object types are abstractions of the  entities used as a part of DBMS

  • The objects are user defined complex data type.
    • An Object is an instance of a class: A Class is a blue print of an object, that actual object is assembled when an instance of the class is created in the client platform.
  • An object has its state, method and properties.
  • An Object has unique name, lifetime and structure
  • An object oriented database supports abstraction, encapsulations, inheritance and polymorphism.
  • Objects can communicate with each other.
  • An object instance is similar to a variable and has its own memory slot.

Typically an object is described to have the following four characteristics
 

  • Identifier: a system-wide unique id for an object
  • Name: an object may also have a unique name in DB (optional)
  • Lifetime: determines if the object is persistent or transient
  • Structure: Construction of objects using type constructors
     
 
Object oriented concepts

Abstract Data Types :
Class definition, provides extension to complex attribute types. The inherited classes are enforced use, the methods/functions of the base class, so that the derived class reports the distinct/altered contexts, under the same category defined in the base class.


Encapsulation:
Implementation of operations and object structure hidden. The concept of data encapsulation is supported in C++ through the use of the public, protected and private keywords which are placed in the declaration of the class.

public : data can be accessed by any user of the class.
protected: only the subclass can access the data.
private: is used locally.

Inheritance :
Sharing of data within hierarchy scope, supports code reusability. The  derived class inherits all the features of its parent or base class, and is free to add features of its own. In addition, this derived class may be used as the base class of an even more specialized class.

Runtime Views.


Polymorphism : meaning some operations or objects can behave differently in different contexts. C++ implements dynamic binding through the use of virtual functions.
 

Abstraction:

Polymorphism:

The method name ( signature) remained same, but the arguments in each were different.

void dosomething(){};
void dosomething(int a1, string str1){}
void dosomething(int a1, string str1, double sal){};
 

Issues with Relational DB

Impossible to represent order in relational data model. Relational databases holds "Unordered"  tabular data , SQL fetch the data as per instruction. While doing this task SQL indexed the data. In this scenario, an object oriented approach would not need indexes, the data-objects becomes dynamic and instance of the objects would have its own memory-space.

SQL can perform “group-by”, it cannot return a grouped result. E.g. “Give me all the authors together with a list of books written by that author”.

Joining multiple tables, may have an overhead which is greater than the object databases. In reality most relational databases are not completely normalized.

The object oriented databases do not offer efficient SQL .
 

 

Use of  DDL and DML statements in  Creating and Manipulating "Object Relational Databases".

 

The Queries in OQL and SQL may look very similar, but the out pout would be very different

Example :

Consider this table auto

dealer Name Body Color
Roselle Ford Ford Windstar White
Elgin Toyota Toyota Camry Gold
Nile Nissan Nissan Pathfinder Red
Lisle Honda Honda Accord White

 Select distinct a.name
From auto a
Where a.color = "White"

SQL Query  would query a able and  return  Rows : with Tuple (Name: value ) 

Name
Ford Windstar
Honda Accord

OQL would query an OODB and return an array or collection of objects.

string   string
Ford Windstar   Honda Accord
Oracle 8 and up, being object-relational databases,  provides the advantages of consistent transactional control and enhanced performances.