[ppt]object oriented databases - overview · web viewobject and object-relationaldatabases object...

21
Object Oriented Databases - Overview ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria University (Karachi Campus) [email protected] https://sites.google.com/site/khawajamcs Contents for this lecture are taken from: Chapter 10 of “Database Systems: Models, Languages …”, 6 th Ed.” by Elmasri and Navathe (Chapter 11 of “Fundamentals of Database Systems” 6 th Ed. by Elmasri and Navathe)

Upload: doannhan

Post on 01-May-2018

235 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Object Oriented Databases - Overview

ADVANCED DATABASES

Khawaja MohiuddinAssistant Professor

Department of Computer SciencesBahria University (Karachi Campus)

[email protected]://sites.google.com/site/khawajamcs

Contents for this lecture are taken from: Chapter 10 of “Database Systems: Models, Languages …”, 6th Ed.” by Elmasri and Navathe(Chapter 11 of “Fundamentals of Database Systems” 6th Ed. by Elmasri and Navathe)

Page 2: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Objectives

To cover an overview of following concepts Object identity Type constructor Encapsulation of operations Programming language compatibility Type hierarchies and inheritance Extents Polymorphism and operator overloading

2

Page 3: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Object and Object-RelationalDatabases

Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS,

previously called ODBMS or OODBMS Why:

To cater the need for new data types for complex structures, for storing images, videos, or large textual items; longer-duration transactions, etc.

To directly or seamlessly integrate with software that is developed using object-oriented programming languages.

Specify: Structure of complex objects Operations that can be applied to these objects

3

Page 4: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Overview of Object Database Concepts

Introduction to object-oriented concepts and features Origins in OO programming languages Object has two components:

• State (value) and behavior (operations) Instance variables

• Hold values that define internal state of object Operation is defined in two parts:

• Signature or interface and implementation

4

Page 5: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Overview of Object Database Concepts (cont’d.) Inheritance

• Permits specification of new types or classes that inherit much of their structure and/or operations from previously defined types or classes

Operator overloading• Operation’s ability to be applied to different types

of objects• Operation name may refer to several distinct

implementations

5

Page 6: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Object Identity, and Objects versus Literals

Unique identity Implemented via a unique, system-generated

object identifier (OID) Immutable (can not be changed)

Most OO database systems allow for the representation of both objects and literals (or values)

6

Page 7: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Complex Type Structures for Objects and Literals

Structure of arbitrary complexity Contain all necessary information that

describes object or literal Nesting type constructors

Construct complex type from other types Most basic constructors:

Atom: Includes basic built-in data types, such as integers, strings, floating point numbers, enumerated types, Booleans, and so on.Each value of the type is considered an atomic (indivisible) single value

7

Page 8: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Complex Type Structures for Objects and Literals (cont’d.) Struct (or tuple):

Made up of several components, and is also sometimes referred to as a compound or composite type.

CollectionAllow part of an object or literal value to include a collection of other objects or values when needed.

8

Page 9: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Complex Type Structures for Objects and Literals (cont’d.)

Collection types: Set - objects or literals that are a set of

distinct elements {i1, i2, ..., in}, all of the same type

Bag - similar to a set except that the elements in a bag need not be distinct

List - an ordered list [i1, i2, ..., in] of OIDs or values of the same type

Array - a fixed size, single-dimensional array of elements of the same type

9

Page 10: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Complex Type Structures for Objects and Literals (cont’d.)

Collection types (cont’d): Dictionary - a collection of two tuples (K, V),

where the value of a key K can be used to retrieve the corresponding value V

Object definition language (ODL) Used to define object types for a particular

database application

10

Page 11: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

11

Page 12: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Encapsulation of Operations and Persistence of Objects

Encapsulation Related to abstract data types and

information hiding in programming languages Define behavior of a type of object based on

operations that can be externally applied External users only aware of interface of the

operations Divide structure of object into visible and

hidden attributes

12

Page 13: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Encapsulation of Operations Object constructor

Used to create a new object Destructor operation

Used to destroy (delete) an object Modifier operations

Modify the states (values) of various attributes of an object

Retrieve information about the object Dot notation used to apply operations to

object

13

Page 14: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Persistence of Objects Transient objects

Exist in executing program Disappear once program terminates

Persistent objects Stored in database and persist after program

termination Naming mechanism (Involves giving an

object a unique persistent name within a particular database)

Reachability (by making the object reachable from some other persistent object. An object B is said to be reachable from an object A if a sequence of references in the database lead from object A to object B)

14

Page 15: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Persistence of Objects (cont’d.)15

Page 16: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Type Hierarchies and Inheritance

Inheritance Definition of new types based on other

predefined types Leads to type (or class) hierarchy

Type: type name and list of visible (public) functions Format:

• TYPE_NAME: function, function, ..., function

16

Page 17: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Type Hierarchies and Inheritance (cont’d.)

Subtype Useful when creating a new type that is

similar but not identical to an already defined type

Example:• EMPLOYEE subtype-of PERSON: Salary, Hire_date,

Seniority• STUDENT subtype-of PERSON: Major, Gpa

17

Page 18: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Type Hierarchies and Inheritance (cont’d.)

Extent Store collection of persistent objects for each

type or subtype Extents are subsets of the extent of class

OBJECT Persistent collection

Stored permanently in the database Transient collection

Exists temporarily during the execution of a program

18

Page 19: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Other Object-Oriented Concepts

Polymorphism of operations Also known as operator overloading Allows same operator name or symbol to be

bound to two or more different implementations

Depending on type of objects to which operator is applied

Can be compile time (static binding) or run time (dynamic binding)

Multiple inheritance Subtype inherits functions (attributes and

methods) of more than one supertype

19

Page 20: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

Other Object-Oriented Concepts (cont’d.)

Selective inheritance Subtype inherits only some of the functions of

a supertype

20

Page 21: [PPT]Object Oriented Databases - Overview · Web viewObject and Object-RelationalDatabases Object databases (ODB, previously called OODB) Object Data Management Systems (ODMS, previously

ConclusionIn this Lecture, we covered following topics Object identity Type constructor Encapsulation of operations Programming language compatibility Type hierarchies and inheritance Extents Polymorphism and operator overloading

21