object_oriented databases, by dr. khalil 1 object-oriented databases dr. awad khalil computer...

37
Object_Oriented Databases , by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Dr. Awad Khalil Computer Science Department Computer Science Department AUC AUC

Upload: calvin-garrison

Post on 03-Jan-2016

235 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

1

Object-Oriented Databases

Dr. Awad KhalilDr. Awad Khalil

Computer Science DepartmentComputer Science Department

AUCAUC

Page 2: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

2

Content

Object-OrientationObject-Orientation Advanced Database ApplicationsAdvanced Database Applications Relational Data Model (Pros & Cons)Relational Data Model (Pros & Cons) Object-Oriented ConceptsObject-Oriented Concepts

Page 3: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

3

Object-Orientation Object-Orientation is an approach to software construction that shows considerable Object-Orientation is an approach to software construction that shows considerable

promise for solving some of the classic problems of software development.promise for solving some of the classic problems of software development. The basic concept behind object technology is that all software should be constructed The basic concept behind object technology is that all software should be constructed

out of standard, reusable components wherever possible.out of standard, reusable components wherever possible. Traditionally, software engineering and database management have existed as separate Traditionally, software engineering and database management have existed as separate

disciplines.disciplines. Database technology has concentrated on the static aspects of information storage, Database technology has concentrated on the static aspects of information storage,

while software engineering has modeled the dynamic aspects of software.while software engineering has modeled the dynamic aspects of software. With the arrival of the third generation of DBMSs, namely Object-Oriented DBMSs With the arrival of the third generation of DBMSs, namely Object-Oriented DBMSs

(OODBMSs) and Object-Relational DBMSs (ORDBMSs), the two disciplines have (OODBMSs) and Object-Relational DBMSs (ORDBMSs), the two disciplines have been combined to allow the concurrent modeling of both data and the processes acting been combined to allow the concurrent modeling of both data and the processes acting upon the data.upon the data.

However, there is currently significant dispute regarding this next generation of However, there is currently significant dispute regarding this next generation of DBMSs. DBMSs.

The success of relational systems in the past two decades is evident, and the The success of relational systems in the past two decades is evident, and the traditionalists believe that it is sufficient to extend the relational model with additional traditionalists believe that it is sufficient to extend the relational model with additional (object-oriented) capabilities. Others believe that underlying relational model is (object-oriented) capabilities. Others believe that underlying relational model is inadequate to handle complex applications, such as CAD, CASE, and GIS.inadequate to handle complex applications, such as CAD, CASE, and GIS.

Page 4: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

4

Advanced Database Applications The90s have seen significant changes in the computer industry.The90s have seen significant changes in the computer industry. In database systems, we have seen the widespread acceptance of RDBMs for In database systems, we have seen the widespread acceptance of RDBMs for

traditional business applications, such as order processing, inventory control, traditional business applications, such as order processing, inventory control, banking, and airline reservations.banking, and airline reservations.

However, existing RDBMSs have proven inadequate for applications whose However, existing RDBMSs have proven inadequate for applications whose needs are quite different from those of traditional business databases needs are quite different from those of traditional business databases applications. These applications include:applications. These applications include: Computer-Aided Design (CAD).Computer-Aided Design (CAD). Computer-Aided Manufacturing (CAM).Computer-Aided Manufacturing (CAM). Computer-Aided Software Engineering (CASE).Computer-Aided Software Engineering (CASE). Office Information Systems (OIS) and Multimedia Systems.Office Information Systems (OIS) and Multimedia Systems. Digital Publishing.Digital Publishing. Geographic Information Systems (GIS).Geographic Information Systems (GIS). Interactive and dynamic Web sites.Interactive and dynamic Web sites. Scientific and Medical ApplicationsScientific and Medical Applications Expert SystemsExpert Systems

Page 5: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

5

Relational Data ModelPros

Strong theoretical foundation, based on first-order predicate logic

 

Simplicity 

Suitability for Online Transaction Processing (OLTP)

 

Support of Data-independence

Cons Poor representation of “real

world” entities 

Semantic overloading 

Poor support for integrity and enterprise constraints

 

Homogenous data structure 

Limited operations 

Difficulty handling recursive queries

 

Impedance mismatch 

Other problems associated with concurrency, schema changes, and poor navigational access

Page 6: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

6

DBMS Generations

Page 7: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

7

Semantic Data Models RDBMSs have their failings, particularly their limited modeling RDBMSs have their failings, particularly their limited modeling

capabilities.capabilities. There has been much research attempting to address this There has been much research attempting to address this

problem.problem. In 1976, Chen presented the Entity-Relationship model that is In 1976, Chen presented the Entity-Relationship model that is

now a widely accepted technique for database design.now a widely accepted technique for database design. In 1979, Codd himself attempted to address some of the failings In 1979, Codd himself attempted to address some of the failings

in his original work with an extended version of the relational in his original work with an extended version of the relational model (RM/T and RM/V2).model (RM/T and RM/V2).

The attempt to provide a data model that represents the “real The attempt to provide a data model that represents the “real world” more closely have been loosely classified as world” more closely have been loosely classified as semantic data modeling. Some of the more famous models are:. Some of the more famous models are: The Semantic Data Model (Hammer and Mcleod, 1981);The Semantic Data Model (Hammer and Mcleod, 1981); The Functional Data Model (Shipman, 1981);The Functional Data Model (Shipman, 1981); The Semantic Association Model (Su, 1983).The Semantic Association Model (Su, 1983).

Page 8: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

8

Object-Relational DBMSs

The relational model has been extended to support advanced database applications.

SQL2 has been extended to support object-oriented features (SQL3).

Page 9: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

9

Object-Oriented Concepts

Abstraction – the process of identifying the essential aspects of – the process of identifying the essential aspects of an entity and ignoring the unimportant properties. There are two an entity and ignoring the unimportant properties. There are two fundamental aspects of abstraction:fundamental aspects of abstraction: Encapsulation – means that an object contains both the data – means that an object contains both the data

structure and the set of operations that can be used to structure and the set of operations that can be used to manipulate it.manipulate it.

Information hiding – means that we separate the external – means that we separate the external aspects of an object from its internal details, which are hidden aspects of an object from its internal details, which are hidden from the outside world. from the outside world.

Modularization – An object is a ‘black box’ that can be – An object is a ‘black box’ that can be constructed and modified independently of the rest of the system, constructed and modified independently of the rest of the system, provided the external interface is not changed.provided the external interface is not changed.

Page 10: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

10

Object-Oriented Concepts

There are two views of encapsulation:There are two views of encapsulation: The object-oriented programming language (OOPL) - The object-oriented programming language (OOPL) -

encapsulation is achievedencapsulation is achieved through Abstract Data Types through Abstract Data Types (ADTs). In this view an object has an (ADTs). In this view an object has an interfaceinterface part and an part and an implementationimplementation part. The interface provides a specification of part. The interface provides a specification of the operations that can be performed on the object; the the operations that can be performed on the object; the implementation part consists of the data structure for the implementation part consists of the data structure for the ADT and the functions that realize the interface. Only the ADT and the functions that realize the interface. Only the interface part is visible to other objects or users.interface part is visible to other objects or users.

The database approachThe database approach – proper encapsulation is achieved by – proper encapsulation is achieved by ensuring that programmers have access only to interface part. ensuring that programmers have access only to interface part. In this way, encapsulation provides a form of In this way, encapsulation provides a form of logical data logical data independenceindependence: we can change the internal implementation of : we can change the internal implementation of an ADT without changing any of the applications using that an ADT without changing any of the applications using that ADT.ADT.

Page 11: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

11

Objects and Attributes Object – A uniquely identifiable entity that contains both the – A uniquely identifiable entity that contains both the

attributes that describe the state of a ‘real world’ object and the attributes that describe the state of a ‘real world’ object and the actions that are associated with it.actions that are associated with it.

Attributes (instance variables) – describe the current state of an (instance variables) – describe the current state of an object.object. A simple attribute – A simple attribute – can be primitive type such as integer, can be primitive type such as integer,

string, real, and so on.string, real, and so on. A complex attribute – A complex attribute – can contain can contain collectionscollections and/or and/or

referencesreferences. For example, the attribute SalesStaff is a . For example, the attribute SalesStaff is a collection of staff objects. A reference attribute represents a collection of staff objects. A reference attribute represents a relationship between objects and contains a value, or relationship between objects and contains a value, or collection of values, which are themselves objects (for collection of values, which are themselves objects (for example, SalesStaff is, more precisely, a collection of example, SalesStaff is, more precisely, a collection of references to Staff objects). An object that contains onereferences to Staff objects). An object that contains one or or more complex attributes is called a more complex attributes is called a complex objectcomplex object..

Page 12: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

12

Object Identity A key part of the definition of an object is unique identity.A key part of the definition of an object is unique identity. In an object-oriented system, each object is assigned an In an object-oriented system, each object is assigned an Object

Identifier (OID) when it is created that is: when it is created that is: System-generated;System-generated; Unique to that object;Unique to that object; Invariant, in the sense that it cannot be altered during its Invariant, in the sense that it cannot be altered during its

lifetime. Once the object is created, this OID will not be lifetime. Once the object is created, this OID will not be reused for any other object, even after the object has been reused for any other object, even after the object has been deleted.deleted.

Independent of the values of its attributes (that is, its state). Independent of the values of its attributes (that is, its state). Two objects could have the same state but would have Two objects could have the same state but would have different identities;different identities;

Invisible to the user. Invisible to the user.

Page 13: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

13

OIDs Advantages:Advantages:

They are efficientThey are efficient They are fastThey are fast They cannot be modified by the userThey cannot be modified by the user They are independent of contentThey are independent of content

Important issues:Important issues: Two objects can appear to be the same to the user, yet have different OIDs Two objects can appear to be the same to the user, yet have different OIDs

and so different objects. If the OIDs are invisible, how does the user and so different objects. If the OIDs are invisible, how does the user distinguish between these two objects? The primary keys are still required!!distinguish between these two objects? The primary keys are still required!!

Two objects are Two objects are identicalidentical (equivalent) if and if they are the same object (equivalent) if and if they are the same object (denoted by ‘=‘), that is their OIDs are the same.(denoted by ‘=‘), that is their OIDs are the same.

Two objects are Two objects are equalequal if their states are the same (denoted by ‘==‘) Objects if their states are the same (denoted by ‘==‘) Objects have have shallow equalityshallow equality if their states contain the same values when we if their states contain the same values when we exclude references to other objects. Objects have exclude references to other objects. Objects have deep equalitydeep equality if their states if their states contain the same values and if related objects also contain the same values.contain the same values and if related objects also contain the same values.

Page 14: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

14

Methods and Messages An object encapsulates both data and functions into a self-An object encapsulates both data and functions into a self-

contained package.contained package. In object technology, functions are usually called In object technology, functions are usually called methods.. Methods define the Methods define the behavior of the object.of the object. Methods can be used to change the object’s state by modifying Methods can be used to change the object’s state by modifying

its attribute values, or to query the values of selected attributes.its attribute values, or to query the values of selected attributes. A method consists of a name and a body that performs the A method consists of a name and a body that performs the

behavior.behavior. The body consists of a block of code that carries out the required The body consists of a block of code that carries out the required

functionality.functionality. Messages are the means by which objects communicate. A are the means by which objects communicate. A

message is simply a request from one object (the sender) to message is simply a request from one object (the sender) to another object (the receiver) asking the second object to execute another object (the receiver) asking the second object to execute one of its methodsone of its methods

Page 15: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

15

Classes, Subclasses, Superclasses, and Inheritance

Classes are blueprints for defining a set of similar objects.Classes are blueprints for defining a set of similar objects. The objects in a class are called The objects in a class are called instances of the class. Each instance has its of the class. Each instance has its

own value(s) for each attribute, but shares the same attribute names and own value(s) for each attribute, but shares the same attribute names and methods with other instances of the class.methods with other instances of the class.

Inheritance allows one class to be defined as a special case of a more general allows one class to be defined as a special case of a more general class.class.

These special cases are known as These special cases are known as subclasses and the more general cases are and the more general cases are known as known as superclasses..

The process of forming a superclass is referred to as The process of forming a superclass is referred to as generalization and the and the process of forming a subclass is process of forming a subclass is specialization..

By default, a subclass inherits all the properties of its superclass(es), and By default, a subclass inherits all the properties of its superclass(es), and additionally defines its own unique properties.additionally defines its own unique properties.

Page 16: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

16

Inheritance

Single Inheritance Multiple Inheritance

Page 17: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

17

Inheritance

Repeated Inheritance Selective Inheritance

Allows a subclass to Allows a subclass to inherit a limited number inherit a limited number of properties from the of properties from the superclasssuperclass

Page 18: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

18

Overriding and Overloading

Overriding – the possibility to redefine a property or a method – the possibility to redefine a property or a method in a subclass.in a subclass. Example: Example: We might define a method in the We might define a method in the staff class to class to

increment salary based on a commissionincrement salary based on a commission::Method void givecommission(float branchProfit) {

salary = salary + 0.02 * branchProfit;

}

--------------------------------------------------------------------------------

ThisThis method can be redefined (overridden) in themethod can be redefined (overridden) in the manager

subclass:subclass: Method void givecommission(float branchProfit) {

salary = salary + 0.05 * branchProfit;

}

Page 19: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

19

Overriding and Overloading

Overloading – allows the name of a method to be reused – allows the name of a method to be reused within a class definition or across class definitions. This means within a class definition or across class definitions. This means that a single message can perform different functions that a single message can perform different functions depending on which object receives it and what parameters are depending on which object receives it and what parameters are passed to the method.passed to the method.

Page 20: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

20

Polymorphism There are three types of polymorphism (from There are three types of polymorphism (from

the Greek meaning: “having many forms”):the Greek meaning: “having many forms”): Operation – – overloading is an example of an overloading is an example of an

operation ( or operation ( or ad hocad hoc) polymorphism.) polymorphism. Inclusion – – such as a method defined in a such as a method defined in a

superclass and inherited in its subclasses.superclass and inherited in its subclasses. Parametric - uses types as parameters in generic uses types as parameters in generic

type, or class declarations.type, or class declarations.

Page 21: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

21

Complex Objects

A complex object is an item that is viewed as a single object in the “real A complex object is an item that is viewed as a single object in the “real world” but combines with other objects in a set of complex world” but combines with other objects in a set of complex A-PART-OF relationships (APO).relationships (APO).

The objects contained may themselves be complex objects, resulting in a n The objects contained may themselves be complex objects, resulting in a n A-PART-OF hierarchy..

A A contained object can be handled in one of two ways: can be handled in one of two ways: First, it be encapsulated within the complex object, and thus forms part of First, it be encapsulated within the complex object, and thus forms part of

the complex object.the complex object. Second, it can be considered to have an independent existence from the Second, it can be considered to have an independent existence from the

complex object. In this case, the object is not stored directly in the parent complex object. In this case, the object is not stored directly in the parent object but only its OID (referential sharing).object but only its OID (referential sharing).

Complex objects are classified as:Complex objects are classified as: Structured complex objects - such as the types we discussed just before.Structured complex objects - such as the types we discussed just before. Unstructured complex object – whose structure can be interpreted only by Unstructured complex object – whose structure can be interpreted only by

the application program. In the database context, unstructured complex the application program. In the database context, unstructured complex objects are sometimes known as Binary Large Objects (BLOBs). objects are sometimes known as Binary Large Objects (BLOBs).

Page 22: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

22

Storing Objects in Relational Databases

One approach to achieving One approach to achieving persistence with the object-oriented persistence with the object-oriented programming language, such as C+programming language, such as C++, or Java, is to use an RDBMS as +, or Java, is to use an RDBMS as the underlying storage engine.the underlying storage engine.

This requires mapping class This requires mapping class instances (objects) to one or more instances (objects) to one or more tuples distributed over one or more tuples distributed over one or more relations. relations.

To handle this type of class To handle this type of class hierarchy, we have two basic tasks hierarchy, we have two basic tasks to perform:to perform:

Design the relations to Design the relations to represent the class hierarchyrepresent the class hierarchy

Design how objects will be Design how objects will be accessed.accessed.

Page 23: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

23

Mapping Classes to Relations

Map each class or subclass to a relationMap each class or subclass to a relation

Staff (staffNo, fName, lName, position, sex, DOB, salary)

Manager (staffNo, bonus, mgrStartDate)

SalesPersonnel (staffNo, salesArea, carAllownce)

Secretary (staffNo, typingSpeed)

With this relational schema we have lost With this relational schema we have lost semantic information: it is no longer clear semantic information: it is no longer clear which relation represents the superclass and which relation represents the superclass and which relations represent the subclasses.which relations represent the subclasses.

Page 24: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

24

Mapping Classes to Relations

Map each subclass to a relationMap each subclass to a relation Manager (staffNo, fName, lName, position, sex, DOB, salary, bonus, mgrStartDate)

SalesPersonnel (staffNo, fName, lName, position, sex, DOB, salary, salesArea, carAllownce)

Secretary (staffNo, fName, lName, position, sex, DOB, salary, typingSpeed)

Again we lost semantic information in this mapping: it is no longer clear that Again we lost semantic information in this mapping: it is no longer clear that these relations are subclasses of a single generic class.these relations are subclasses of a single generic class.

Page 25: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

25

Mapping Classes to Relations

Map the hierarchy to a single a relationMap the hierarchy to a single a relation

Staff (staffNo, fName, lName, position, sex, DOB, salary, bonus, mgrStartDate, salesArea, carAllownce, typingSpeed, typeFlag)

Again we lost semantic information in this mapping. Further, this mapping Again we lost semantic information in this mapping. Further, this mapping will produce an unwanted number of nulls for attributes that don’t apply to will produce an unwanted number of nulls for attributes that don’t apply to that tuple.that tuple.

Page 26: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

26

Object Structure (ODMG MODEL) In OO database systems, the values (or states) In OO database systems, the values (or states)

of complex objects may be constructed from of complex objects may be constructed from other objects by using certain type constructors.other objects by using certain type constructors.

  

One way of representing an objects is to view One way of representing an objects is to view each object as a triple each object as a triple (i, c, v), where: where:

  

i : is a unique object identifier (OID).i : is a unique object identifier (OID).  

c : is a constructor (that is, an indication of how c : is a constructor (that is, an indication of how the object value is constructed).the object value is constructed).

  

v : is the object value (or state).v : is the object value (or state).

Page 27: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

27

Object Structure (Cont’d) There are the following types of constructors:There are the following types of constructors:

Basic constructors:Basic constructors: atom, tuple, set. atom, tuple, set. Other constructors:Other constructors: list, array, bag. list, array, bag. The common constructor:The common constructor: domain D, domain D, that that

contains all basic atomic values that are contains all basic atomic values that are directly available in the system. These directly available in the system. These typically include integers, real numbers, typically include integers, real numbers, character strings, Booleans, dates, and any character strings, Booleans, dates, and any other data types that the system supports other data types that the system supports directly.directly.

Page 28: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

28

Object Structure (Cont’d) An object value v is interpreted on the basis of the value of the An object value v is interpreted on the basis of the value of the

constructor c in the triple (i, c, v):constructor c in the triple (i, c, v): If c = atom, then the value v is an atomic value from the If c = atom, then the value v is an atomic value from the

domain D of basic values supported by the system.domain D of basic values supported by the system. If c = set, the value v is a set of object identifiers {iIf c = set, the value v is a set of object identifiers {i11, i, i22, ..., , ...,

iinn}, which are the identifiers (OIDs) for a set of objects that }, which are the identifiers (OIDs) for a set of objects that are typically of the same type.are typically of the same type.

If c = tuple, the value v is a tuple of the form < aIf c = tuple, the value v is a tuple of the form < a11:i:i11, a, a22:i:i22, ..., , ..., aann:i:inn>, where each a>, where each ajj is an attribute name (sometimes called is an attribute name (sometimes called an instance variable name) and each ian instance variable name) and each ijj is an object identifier is an object identifier (OID).(OID).

If c = list, the value v is an ordered list of object identifiers If c = list, the value v is an ordered list of object identifiers [i[i11, i, i22, ..., i, ..., inn] of the same type.] of the same type.

If c = array, the value v is an array of object identifiers.If c = array, the value v is an array of object identifiers.

Page 29: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

29

Object Structure – An Example We assume, for the following examples, that We assume, for the following examples, that

everything is an object, including basic values.everything is an object, including basic values.  

We assume that we have the constructors atom, set, and We assume that we have the constructors atom, set, and tuple.tuple.

  

We use iWe use i11, i, i22, i, i33, ... to stand for unique system-generated , ... to stand for unique system-generated object identifiers.object identifiers.

  

An object is defined by a triple: An object is defined by a triple:

(OID, type constructor, value).(OID, type constructor, value).

Page 30: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

30

Object Structure – An Example

Page 31: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

31

Object Structure – An ExampleConsider the following objects:Consider the following objects:   O11 = (i11, atom, Houston)

  O22 = (i22, atom, Bellaire)

  O33 = (i33, atom, Sugarland)

  O4 4 = (i44, atom, 5)

  O55 = (i55, atom, Research)

  O66 = (i66, atom, 22-MAY-78)

O77 = (i77, set, {i11, i22, i33})

O88 = (i88, tuple, <DNAME:i55, DNUMBER:i44,

MGR:i99, LOCATIONS:i77,

EMPLOYEES:i1010, PROJECTS:i1111>)

O99 = (i99, tuple, <MANAGER:i1212, MANAGERSTARTDATE:i66>)

 

O1010 = (i1010, set, {i1212, i1313, i1414})

  O1111 = (i1111, set, {i1515, i1616, i1717})

Page 32: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

32

Graphical Representation

Page 33: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

33

Useful References

http://http://jdocentral.comjdocentral.com//

http://http://www.fastobjects.comwww.fastobjects.com//

Page 34: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

34

Useful References

Page 35: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

35

Page 36: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

36

Page 37: Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC

Object_Oriented Databases, by Dr. Khalil

37

Thank you