Database - Assignment

San77
ObjectandObject-RelationalDatabaseChapter12.ppt.pdf

Object and Object-Relational Database

Dr. Buleje

Outline

 Overview of Object Database Concepts

 Object-Relational Features

 Object Database Extensions to SQL

 ODMG Object Model and the Object Definition

Language ODL

 Object Database Conceptual Design

 The Object Query Language OQL

Slide 12- 2

Object and Object-Relational

Databases

 Object Oriented Database (OODBs)

 Object databases (ODB)

 Specify:

 Structure

 Operations

Slide 12- 3

Overview of Object Database

Concepts

 Introduction to object-oriented concepts and

features

 Origins in OO

 Object has two components:

 State

 Behavior

 Instance variables (attributes)

 Operation

 Inheritance

 Operator overloading

Slide 12- 4

Object Identity, and Objects versus

Literals

 Object has Unique identity

 Most OO database systems allow for the

representation of both objects and literals

Slide 12- 6

Complex Type Structures for Objects

and Literals

 Structure of arbitrary complexity

 Nesting type constructors

 Type constructors (type generators):

 Atom

 Struct

 Collection

Slide 12- 7

Complex Type Structures for Objects

and Literals (cont’d.)

 Collection types:

 Set

 Bag

 List

 Array

 Dictionary

 Object definition language (ODL)

Slide 12- 8

Encapsulation of Operations

 Encapsulation

 Constructor operation

 Destructor operation

 Modifier operations

 Retrieve operation

Slide 12- 11

Persistence of Objects

 Transient objects

 Persistent objects

Slide 12- 13

Type (Class) Hierarchies and

Inheritance

 Inheritance

 Leads to type (or class) hierarchy

 Type: type name and list of visible (public)

functions (attributes or operations)

 Format:

 TYPE_NAME: function, function, ...,

function

Slide 12- 15

Type (Class) Hierarchies and

Inheritance (cont’d.)

 Subtype

 Example:

 EMPLOYEE subtype-of PERSON: Salary,

Hire_date, Seniority

 STUDENT subtype-of PERSON: Major, Gpa

Slide 12- 16

Type (Class) Hierarchies and

Inheritance (cont’d.)

 Extent

 Persistent collection

 Transient collection

Slide 12- 17

Other Object-Oriented Concepts

 Polymorphism of operations

 Multiple inheritance

Slide 12- 18

Summary of Object Database

Concepts

 Object identity

 Type constructors (type generators)

 Encapsulation of operations

 Programming language compatibility

 Type (class) hierarchies and inheritance

 Extents

 Polymorphism and operator overloading

Slide 12- 19

Object-Relational Features:

Object DB Extensions to SQL

 Type constructors (generators)

 Mechanism for specifying object identity

 Encapsulation of operations

 Inheritance mechanisms

 Provided using keyword UNDER

Slide 12- 20

User-Defined Types (UDTs) and

Complex Structures for Objects

 UDT syntax:

 CREATE TYPE <type name> AS

(<component declarations>);

Slide 12- 21

User-Defined Types and Complex

Structures for Objects (cont’d.)

 Array type – to specify collections

 Reference array elements using []

 CARDINALITY function

 Early SQL had only array for collections

Slide 12- 22

Object Identifiers Using Reference

Types

 Reference type

 Examples:

 REF IS SYSTEM GENERATED

 REF IS <OID_ATTRIBUTE>

<VALUE_GENERATION_METHOD> ;

Slide 12- 23

Creating Tables Based on the UDTs

 INSTANTIABLE

Slide 12- 24

Encapsulation of Operations

 User-defined type

 Format: CREATE TYPE <TYPE-NAME> (

<LIST OF COMPONENT ATTRIBUTES AND THEIR TYPES>

<DECLARATION OF FUNCTIONS (METHODS)>

);

Slide 12- 25

Specifying Type Inheritance

 NOT FINAL:

 UNDER

Slide 12- 28

Summary of SQL Object Extensions

 UDT to specify complex types

 INSTANTIABLE specifies if UDT can be used to

create tables; NOT FINAL specifies if UDT can be

inherited by a subtype

 REF for specifying object identity and inter-

object references

 Encapsulation of operations in UDT

 Keyword UNDER to specify type inheritance and

table inheritance

Slide 12- 36

ODMG Object Model and Object

Definition Language ODL

 ODMG object model

 Objects and Literals

 Object has five aspects

 Identifier, name, lifetime, structure, and

creation

 Literal

Slide 12- 37

The ODMG Object Model and the ODL

(cont’d.)

 Behavior

 State

 Interface

 Class

Slide 12- 38

Inheritance in the Object Model of

ODMG

 Behavior inheritance

 EXTENDS inheritance

 Keyword extends

Slide 12- 39

Atomic (User-Defined) Objects

 Specified using keyword class in ODL

 Attribute

 Relationship

 Operation signature

Slide 12- 42

Extents, Keys, and Factory Objects

 Extent

 Key

 Factory object

Slide 12- 44

Object Database Conceptual Design

 Conceptual design of ODB Vs. RDB

 Difference between relational model and object

model of data

Slide 12- 53

The Object Query Language OQL

 Query language proposed for ODMG object

model

 Simple OQL queries, database entry points, and

iterator variables

Slide 12- 56