0% found this document useful (0 votes)
2 views5 pages

Distributed Database Unit5

Uploaded by

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

Distributed Database Unit5

Uploaded by

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

1

Unit 5: Object-Oriented Database Concepts

1. Overview of Object-Oriented Concepts


2. Object Identity, Object Structure, and Type Constructors
3. Encapsulation of Operations
4. Methods, and Persistence
5. Type Hierarchies and Inheritance
6. Complex Objects
7. Other Objected-Oriented Concepts

1. Overview of Object-Oriented Concepts

• Object-oriented databases (OODB) integrate object-oriented programming (OOP)


principles with database management.
• Objects encapsulate data (state) and methods (behavior), promoting modularity and
reusability.
• Object databases overcome the impedance mismatch issue between relational databases
and programming languages by storing objects directly.

2. Object Identity

• Object Identity (OID) is a unique system-generated identifier assigned to objects.


• Unlike relational databases where identity is based on primary keys, OIDs remain
unchanged even if object attributes change.
• There are two types of OIDs:
o Physical Identifiers (POID): Based on an object’s memory or disk location.
o Logical Identifiers (LOID): Independent of storage location, allowing greater
flexibility.

Example:

Consider two users referencing the same Car object:

(i2, [name: John, mycar: c1])


(i3, [name: Mary, mycar: c1])

Both John and Mary share the same car object (c1) due to object identity.

1
Er. Sital Prasad Mandal
2

3. Object Structure and Type Constructors

Objects consist of:

1. Attributes: Define an object’s properties.


2. Methods: Define an object’s behavior.
3. Type Constructors: Define complex structures, including:
o Tuple Constructor: Groups attributes into named fields.
o Set Constructor: Represents a collection of objects.
o List/Array Constructor: Stores ordered elements.

Example:
type Car
attributes
engine : Engine
tires : [LF: Tire, RF: Tire, LR: Tire, RR: Tire]
methods
age: Real
replaceTire(place, tire)

• Tires are modeled as a tuple-valued attribute using named fields (LF, RF, LR, RR).
• Method replaceTire updates a specific tire.

4. Encapsulation of Operations, Methods, and Persistence

• Encapsulation ensures that an object’s data is accessed only through well-defined


methods.
• Methods can be:
o Public: Accessible by other objects.
o Private: Restricted to internal use.
• Persistence refers to an object’s ability to outlive program execution, requiring object
storage management.

Example:

• A BankAccount object has encapsulated attributes:

type BankAccount
attributes
balance: Float
methods
deposit(amount: Float)
withdraw(amount: Float)

• The balance attribute is private, ensuring controlled access through deposit and withdraw
methods.

2
Er. Sital Prasad Mandal
3

5. Type Hierarchies and Inheritance

• Inheritance allows classes to reuse attributes and methods of superclasses.


• Types of inheritance:
1. Single Inheritance: A subclass inherits from one superclass.
2. Multiple Inheritance: A subclass inherits from multiple superclasses.

Example:
type Vehicle
attributes
make: String
model: String
methods
start()
type Car extends Vehicle
attributes
numDoors: Integer
methods
honk()

• Car inherits make, model, and start() from Vehicle, while adding numDoors and honk().

6. Complex Objects

• Complex objects are objects that contain references to other objects.


• Objects can be:
o Composite Objects: Allow object sharing.
o Complex Objects: Prohibit object sharing.

Example:

A Person object referencing a Car object:

type Person
attributes
name: String
myCar: Car

• If multiple people reference the same Car, it’s composite.


• If each Person has an exclusive Car, it’s complex.

7. Other Object-Oriented Concepts

Additional OODB concepts include:

3
Er. Sital Prasad Mandal
4

1. Collections: Groups of objects (e.g., lists, sets, and bags).


2. Polymorphism: Allows methods to operate on different data types.
3. Method Overloading: Defines multiple methods with the same name but different
parameters.
4. Method Overriding: Subclasses redefine inherited methods for specialized behavior.

1. Overview of Object-Oriented Concepts


OODBMS integrates object-oriented principles with database technology to store, manage, and
retrieve complex data efficiently. Key characteristics include:

1. Encapsulation: Combines data and methods into objects.

2. Persistence: Objects remain stored beyond program execution.

3. Inheritance: Objects can inherit properties from parent objects.

4. Complex Objects: Objects can contain other objects, forming hierarchies.

5. Identity: Each object has a unique identifier (OID).

2. Object Identity (OID)


Each object in an OODBMS has a unique Object Identifier (OID), which remains unchanged
even if the object’s attributes are modified.

3. Object Structure and Type Constructors


Objects in an OODBMS consist of attributes and methods. Type constructors define how objects
are structured:

1. Atomic Types: Basic data types like int, string, float.

2. Collection Types: Objects containing multiple values (Set, List, Array).

3. Reference Types: Objects referring to other objects.

4. Tuple Types: Used for complex object representation.

4. Encapsulation and Persistence


Encapsulation ensures data and methods are bound together. Persistence ensures objects exist
beyond program execution using serialization or ORM techniques.

5. Type Hierarchies and Inheritance


Inheritance allows new object classes to derive attributes and behaviors from existing ones. Types
of inheritance include:

1. Single Inheritance: One class inherits from another.

2. Multiple Inheritance: A class inherits from multiple parent classes.

4
Er. Sital Prasad Mandal
5

3. Multilevel Inheritance: A class inherits from another, which in turn inherits from another.

4. Hierarchical Inheritance: Multiple classes inherit from a single parent class.

6. Complex Objects and Other OODBMS Concepts


Complex objects contain nested structures, reducing redundancy and improving data integrity.
Other important OODBMS concepts include:

1. Polymorphism: Methods with the same name perform different functions.

2. Association and Aggregation: Objects can be related to other objects.

3. Query Optimization: OODBMS uses Object Query Language (OQL) for queries.

5
Er. Sital Prasad Mandal

You might also like