0% found this document useful (0 votes)
6 views23 pages

Object-Oriented Database Concepts

The document provides an overview of object-oriented databases, highlighting their structure, operations, and advantages over traditional database systems. It discusses key concepts such as object identity, class operations, and the importance of naming and reachability for persistent objects. Additionally, it covers type hierarchies and inheritance in object-oriented design, emphasizing the differences between traditional and object-oriented database models.

Uploaded by

yesusgooftadha6
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views23 pages

Object-Oriented Database Concepts

The document provides an overview of object-oriented databases, highlighting their structure, operations, and advantages over traditional database systems. It discusses key concepts such as object identity, class operations, and the importance of naming and reachability for persistent objects. Additionally, it covers type hierarchies and inheritance in object-oriented design, emphasizing the differences between traditional and object-oriented database models.

Uploaded by

yesusgooftadha6
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Chapter 1

Concepts for Object-Oriented Databases


Recap
 Database
 Comparison of File system & Database system
 Types of Database Models
 Actors on the Scene
 Database schemas
 Components of DBMS Languages
 Advantages of Database System
 Basic concepts of E-R
model
 Problem with E-R
models
2
Recap Cont’d…
 Logical Database Design
 Normalization
 Purpose of normalization
 Information redundancy and update anomalies
 Functional dependencies
 Process of normalization (1NF, 2NF, 3NF)
 Physical Database Design
 Physical database design process
 Database design and implementation for
relational databases

3
Overview of Object-Oriented Concepts
 Object-oriented databases give designer to
specify
 The structure of complex objects
 The operations that can be applied to objects
 An object typically has two components:
Object
•State(Value)
•Behavior(operations)

4
Overview of Object-Oriented Concepts (Cont.)
Maintain a direct correspondence between
real-world and database objects
A real-world object may have different names for
key attributes in different relations in traditional
database systems

E.G. EMP_ID, SSN in different relations

OODBs provide a unique system-generated


object identifier for each object

5
Overview of Object-Oriented Concepts (Cont.)
 Objects may have an object structure of
arbitrary complexity

 Information about a complex object is often


Distributed over many relations or records in
traditional database systems

1NF in relational databases

6
Object Identity

 Unique identity for each independent


object stored in the database

 Created by a unique, system-generated


object identifier, or OID

7
Object Identity (Cont.)
► Properties of OID
► immutable: the OID value of a particular object should
not change Each OID is used only once
► The value will not be destroyed even if an object is
removed from the database, its OID should not be
assigned to another object
OID should not depend on any physical address
attribute values of the object

Most OO database systems allow for the representation of


both objects and values (having no OIDs)

8
Specifying Object Behavior via Class
Operations

In relational model, selecting, inserting, deleting


and modifying tuples are generic.

 Define the behavior of a type of object based


on the operations that can be externally
applied to object of that type
 create (insert) or destroy (delete) objects
 update the object state
 retrieve parts of the object state
 apply some calculations
 combination of retrieval, calculation, and update

9
Specifying Object Behavior via Class
Operations (Continued)
 An operation is defined in two parts.
 The first part, called the signature or interface
of the operation, specifies the operation name
and arguments (or parameters).
 The second part, called the method, specifies
the implementation of the operation, usually
written in some general-purpose programming
language.

10
Specifying Object Behavior via Class
Operations (Continued)
Operations 1. object constructors
2. object destructor
3. object modifier
4. retrieval
 interface
 define the name and arguments (parameters) of
each operation
 signature (included in the class definition)
 implementation
 method (defined using programming languages)
 it is invoked by sending a message to the object to
execute the corresponding method

11
Using OODDL to define Employee and
Department classes
define class Employee:
type tuple ( fname: string;
lname: string;
ssn: string;
birthdate: Date;
type address string;
definition sex: char;
salary: float;
supervisor: Employee;
dept: Department);

definition create_emp: Employee;


of destroy_emp : boolean;
operations end Employee;
12
Using OODDL to define Employee and
Department classes (Continued)
define class Department
type tuple (
dname: string;
dnumber: integer;
type mgr: tuple (manager: Employee;
startdate: Date; );
definition locations: set (string);
employees: set (Employee);
projects: set (Project); );

operations
number_of_emps : integer;
create_dept: Department,
definition destroy_dept: boolean;
of assign_emp (e: Employee): boolean;
(* adds a new employee to the department *)
operations remove_emp (e: Employee): boolean;
(* removes an employee from the department *)
end Department;
13
Class Operations
 object constructor
 create a new object
 destructor
 destroy an object
 object modifier
 modify various attribute of an object
 dot notation
 d.no_of_emps where d is a reference to a
department object and no_of_emps is an
operation
refer to attributes of an object: [Link], [Link]
The term class is often used to refer to a type definition,
along with the definitions of the operations for that type.

14
Specifying Object Persistence via
Naming and Reachability
 transient object
 exist in the executing program and disappear
once the program terminates
 persistent object
 stored in the database and persist after program
termination
 naming mechanism
 give an object a unique persistent name through
which it can be retrieved by this and other
program

15
Reachability
 reachability mechanism
 make the object reachable from some persistent
object
 an object B is said to be reachable from an
object A if a sequence of references in the
object graph lead from object A to object B

 Let N defines a persistent collection of objects of


class C
 create a named persistent object N, whose state is a set
or list of objects of some class C
 add objects of C to the set or list and make them
reachable from N

16
Creating persistent objects by naming and
reachability
define class DepartmentSet:
type set (Department);

operations
add_dept(d: Department): boolean;
remove_dept (d: Department): boolean,
create_dept_set: DepartmentSet;
destroy_dept_set: boolean;
end DepartmentSet;

persistent name AllDepartments: DepartmentSet ;


(* AllDepartments is a persistent named object of type set DepartmentSet*)

.....
d := create_dept ;
..... (* creates a new department object in the variable d *)
b := AllDepartments.add_dept (d) ;
(* make d persistent by adding it to the persistent named object AllDepartments *)
17 AllDepartments object: extent of the class Department
Differences between traditional
databases and OO databases
 traditional database models
 when an entity type or class is defined in ER, it
represents both type declaration and persistent
set
 OO approaches
 a class declaration specifies only the type and
operations for a class of objects
 user must define a persistent object whose value
is the collection of references to all persistent

18
Type Hierarchies and Inheritance
 type (or class) hierarchy
 define new types based on other predefined types (or
classes)
 type
 type name
 a number of attributesfunctions
(instancewith zero arguments
variables)
 operations (methods)
 functions
TYPE_NAME: function, function, …, function
 PERSON: Name, Address, Birthdate, Age, SSN
EMPLOYEE subtype-of PERSON: Salary,
HireDate, Seniority
STUDENT subtype-of PERSON: Major, GPA

19
Type Hierarchies and Inheritance
attributes(triangle,rectangle,circle)
GEOMETRY_OBJECT: Shape, Area, ReferencePoint

RECTANGLE subtype-of
GEOMETRY_OBJECT: Width, Height

TRIANGLE subtype-of
GEOMETRY_OBJECT: Side1, Side2, Side3

CIRCLE subtype-of GEOMETRY_OBJECT: Radius

20
Type Hierarchies and Inheritance (Cont.)
RECTANGLE subtype-of
GEOMETRY_OBJECT (Shape=‘rectangle’): Width, Height

TRIANGLE subtype-of
GEOMETRY_OBJECT (Shape=‘triangle’): Side1, Side2,
Side3

CIRCLE subtype-of
GEOMETRY_OBJECT (Shape=‘circle’): Radius

21
Inheritance
 multiple inheritance
 when T is a subtype of two (or more) types,
T inherits the functions (attributes and
methods) of both supertypes
 type lattice instead of type hierarchy
 if a function is inherited from some common
supertype, it is inherited only once
 ambiguity resolution
 alarm users
 system default
 disallow multiple inheritance

22
Thanks for
Attention

23

You might also like