0% found this document useful (0 votes)
8 views66 pages

Chapter_1.- OODB Additional

Uploaded by

amanu21394
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)
8 views66 pages

Chapter_1.- OODB Additional

Uploaded by

amanu21394
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
You are on page 1/ 66

Object-Oriented Database 12/14/2024

HiLCoE School of Computer Science & Technology


Chapter One: Object-Oriented Database
Course Title : Advanced Database Systems
Outlines 2

 Object-Oriented Concepts
 Object Identity
 Object Structure
 Type Constructors
 Encapsulation
 Methods, and Persistence
 Type Hierarchies and Inheritance

Object-Oriented Database 12/14/2024


Overview of Object-Oriented Concepts

• Object-Oriented Databases (OODB) are a type of database


management system that is designed to store and retrieve data using
the principles of object-oriented programming (OOP).

• In contrast to traditional relational databases that organize data into


tables with rows and columns, object-oriented databases model data as
objects, which are instances of classes in an object-oriented
programming language.

12/14/2024 Object-Oriented Database 3


Cont. …

• Objects are self-contained units that contain both data and the operations or
methods that can be performed on that data. It helps in efficient representation and
management of complex data structures and relationships.

• Object-oriented databases are often used in applications that require the efficient
management of complex data structures and relationships, such as CAD/CAM
systems, geographic information systems, and document management systems.

• They are also well suited for applications that require the integration of different
data types and sources, such as multimedia data or data from multiple sources.

12/14/2024 Object-Oriented Database 4


Cont. …

12/14/2024 Object-Oriented Database 5


Components of Object-Oriented Database Model

• The main components of an object-oriented database model are:

Objects

• Objects represent real-world entities by combining data with related operations.

• For example, an object could contain a customer’s name, address, and account
balance data along with methods to modify or retrieve that data.

• Objects enable encapsulation of both state through data attributes and behavior
through methods. This provides a cohesive and modular approach to structure
data.

12/14/2024 Object-Oriented Database 6


Cont. …
Classes

• Classes act as templates or blueprints for creating objects with the same
kinds of data and behaviors. A class defines the structure for its instances
what attributes or data members the object will contain as well as what
methods or functions it will have.

• Classes allow for organization of objects that share similar properties and
behaviors. This promotes reusability and maintainability in database design.

12/14/2024 Object-Oriented Database 7


Cont. …

Inheritance
• Inheritance allows classes to inherit attributes and methods from parent
classes. This enables code reuse and the creation of specialized child
classes.
• The class hierarchy represents these parent-child relationships. A base or
superclass provides common data and behaviors shared by derived
subclasses down the hierarchy. Subclasses can override or extend parent
functionality.

12/14/2024 Object-Oriented Database 8


Cont. …
Methods

• Methods are functions defined within a class that represent the


behaviors or actions that objects created from that class can perform.

• Methods operate on the object’s data members and encapsulate the


logic for manipulating the object’s state. This provides an organized
approach to implementing functionality for the class.

12/14/2024 Object-Oriented Database 9


Cont. …

Attributes

• Attributes are data members that hold the state or properties of an


object instantiated from a class. They define the characteristics of
those objects.

• Attributes store descriptive information about the object that can be of


various data types like strings, numbers, etc. This allows
representation of diverse properties.

12/14/2024 Object-Oriented Database 10


Cont. …

Encapsulation

• Encapsulation binds together the data attributes and the methods


that manipulate them within a class. Certain components may be
hidden or restricted from direct access externally to protect data
integrity.

• Interaction is only through defined interfaces. This guards against


misuse while enabling specialized implementation details.

12/14/2024 Object-Oriented Database 11


Cont. …

12/14/2024 Object-Oriented Database 12


Cont. …
Polymorphism

• Polymorphism allows objects of different classes to be treated as


objects of a common superclass type and used interchangeably.

• A single method interface can work across multiple data types.

• Polymorphism provides flexibility to extend systems and write more


generic reusable code.

12/14/2024 Object-Oriented Database 13


Cont. …
Persistence
• Persistence refers to objects continuing to exist even after the program that
created them ends. Their state is saved so objects can be retrieved in subsequent
sessions. This is crucial for storing data long-term without loss of information
between interactions.
Identity
• Every object is assigned a unique identifier that distinguishes it from other
objects even if they have identical attribute values. This allows precise
management of object references and relationships.

12/14/2024 Object-Oriented Database 14


Cont. …

Transactions

• Transactions group operations into an all-or-nothing unit. If any part


fails, the entire transaction is rolled back to maintain database
consistency.

• Transactions provide reliability with features like atomicity, isolation,


and durability that ensure integrity.

12/14/2024 Object-Oriented Database 15


Cont. …

12/14/2024 Object-Oriented Database 16


Difference Between RDBMS and OODBMS
• There are several key differences between a relational database and an
object-oriented database, including the following:

Data organization: In a relational database, data is organized and


stored in tables, with each table containing rows and columns of data.

• In an object-oriented database, data is organized and stored as objects,


which are self-contained units that contain both data and the
operations or methods that can be performed on that data.
12/14/2024 Object-Oriented Database 17
Cont. …

Data relationships: In a relational database, data relationships are


defined and managed using keys and foreign keys, which link tables
and records together.

• In an object-oriented database, data relationships are defined and


managed using inheritance and polymorphism, which allow objects
to take on different forms or behaviors depending on the context in
which they are used.

12/14/2024 Object-Oriented Database 18


Cont. …

Query language: In a relational database, data is queried and


manipulated using a structured query language (SQL), which is a
standardized and widely used language for managing and querying
data.

• In an object-oriented database, data is queried and manipulated using


object-oriented query languages, which are specialized languages
that are designed for managing and querying object-oriented data.

12/14/2024 Object-Oriented Database 19


Cont. …

Data manipulation: In a relational database, data manipulation is


typically performed using SQL queries, which can be used to insert,
update, delete, and retrieve data from the database.

• In an object-oriented database, data manipulation is performed using


the operations or methods defined on the objects themselves, which
allows for the efficient manipulation of complex data structures and
relationships.
12/14/2024 Object-Oriented Database 20
Cont. …

12/14/2024 Object-Oriented Database 21


Object-Oriented Database Examples
• Let’s see object oriented database examples:
ObjectStore
• ObjectStore was one of the first commercially available object-oriented
database management systems (ODBMS). It was developed by Object
Design starting in the late 1980s.
• ObjectStore gained popularity for use in CAD, engineering, and
telecommunications applications. It provided flexibility in modeling
complex data relationships compared to relational databases.

12/14/2024 Object-Oriented Database 22


Cont. …

Key features:

• Developed C++ APIs for database access

• Supported database clustering for high availability

• Enabled bidirectional object navigability and references

12/14/2024 Object-Oriented Database 23


Cont. …

Versant

• Versant is an OODBMS optimized for speed, scalability, and handling


complex data models. It can be used in transactional applications that
require real-time performance and the ability to query interconnected data.

• Versant is utilized in telecom, finance, defense, and healthcare systems


that need to rapidly ingest and analyze large volumes of data with low
latency.

12/14/2024 Object-Oriented Database 24


Cont. …

• Key features:

• Horizontally scalable using sharing

• ACID support ensures data integrity

• SQL support for querying objects

• High performance caching and clustering

12/14/2024 Object-Oriented Database 25


Cont. …

12/14/2024 Object-Oriented Database 26


Advantages of Object-Oriented Databases

Efficient representation of complex data structures: One of the


main advantages of object-oriented databases is that they allow for the
efficient representation and management of complex data structures
and relationships.

• This is particularly useful for applications that require the integration


of different data types and sources, such as multimedia data or data
from multiple sources.
12/14/2024 Object-Oriented Database 27
Cont. …
Improved code reuse and modularity: Object-oriented databases support
inheritance and polymorphism, which allow for the efficient reuse of code
and data structures. This simplifies the development and management of
complex data structures, and improves the modularity and maintainability of
the database.
Support for data integration: Object-oriented databases are well suited
for applications that require the integration of different data types and
sources, since they support the representation of complex data structures
and relationships.
12/14/2024 Object-Oriented Database 28
Cont. …
Flexibility and adaptability: Object-oriented databases are highly flexible and
adaptable, which means that they can easily handle changes in data structures and
requirements. This is particularly useful for applications that require the ability to
quickly adapt to changing business needs and requirements.

Improved performance: Object-oriented databases can have improved


performance compared to other database models, since they are optimized for the
efficient representation and manipulation of complex data structures and
relationships.

12/14/2024 Object-Oriented Database 29


Disadvantages of Object-Oriented Databases

Complexity and learning curve: One of the main disadvantages of


object-oriented databases is that they can be complex and difficult to
learn and use, especially for developers who are not familiar with
object-oriented programming (OOP).

• This can increase the time and resources required to develop and
maintain applications that use an object-oriented database.

12/14/2024 Object-Oriented Database 30


Cont. …
Limited support for SQL: Object-oriented databases do not support SQL,
which is the standardized and widely used language for managing and querying
data in relational databases. This can limit their compatibility with other systems
and applications that use SQL, and may require developers to learn and use
specialized object-oriented query languages.
Limited vendor support: Object-oriented databases are not as widely used as
other database models, which means that they may have limited vendor support
and resources compared to other database models. This can make it more difficult
to find support and expertise for object-oriented databases.

12/14/2024 Object-Oriented Database 31


Cont. …

Potential vendor lock-in: Organizations that use an object-oriented


database may be dependent on their database vendor, which can create
vendor lock-in and limit their ability to switch to another database in
the future.

Compatibility issues: Object-oriented databases may not be


compatible with other database models, which can limit their
interoperability and integration with other systems and applications.
12/14/2024 Object-Oriented Database 32
Object Identity, Object Structure, and Type Constructors

• In Object-Oriented Databases (OODBs), three important concepts are:


Object Identity
Object Structure, and
Type Constructors.

• Let's explore each of these concepts:

12/14/2024 Object-Oriented Database 33


Object Identity
• Object Identity refers to the unique identifier associated with each object
in the database. It is a crucial aspect of OODBs because it allows the system
to distinguish one object from another.
• Object Identity ensures that each object is uniquely identifiable, which is
essential for maintaining data integrity and supporting relationships between
objects.
• Unlike in relational databases where primary keys are used for
identification, in OODBs, the identity is often inherent in the object itself.

12/14/2024 Object-Oriented Database 34


Cont. …

• Here are key aspects of Object Identity in Object-Oriented Databases:

Unique Identifier: Each object within the OODB is assigned a unique


identifier, often referred to as an "object identifier" or "OID." This
identifier is used to distinguish one object from another.

Inherent Identity: Object Identity is often inherent in the object itself and
is not dependent on external factors.

• It is a key feature of the encapsulation principle in object-oriented


programming, where an object's identity is encapsulated within the object.
12/14/2024 Object-Oriented Database 35
Cont. …
Support for Relationships: Object Identity plays a crucial role in
establishing and maintaining relationships between objects. When one
object refers to another object through attributes or associations, it is the
unique identifier that allows for accurate referencing.

Persistence: Object Identity is maintained consistently across different


states of an object. Even if an object is stored, retrieved, modified, and re-
stored in the database, its unique identity remains the same.

12/14/2024 Object-Oriented Database 36


Cont. …
Identity Independence: Object Identity provides identity independence,
meaning that the identity of an object is maintained regardless of changes to
its attributes or state. This is in contrast to relational databases, where the
primary key is often tied to the data values and may change if those values
change.

Object Evolution: Object Identity supports the evolution of objects over


time. As objects are updated or modified, their unique identity allows the
system to track and manage changes effectively.

12/14/2024 Object-Oriented Database 37


Object Structure

Object Structure refers to the way in which data and methods are
organized within an object. It encompasses the attributes (data) and
methods (functions) that define the behavior of the object.
The organization of data and methods within an object is fundamental to
the encapsulation principle of object-oriented programming.
• Encapsulation ensures that an object's internal representation is hidden from
the outside world, and interaction with the object is performed through well-
defined interfaces.

12/14/2024 Object-Oriented Database 38


Cont. …
• Here are key aspects related to Object Structure in Object-Oriented Databases:

Classes: Objects in an OODB are instances of classes. Classes define the


blueprint or template for creating objects. They specify the attributes (data) and
methods (functions) that objects of that class will have.

Attributes: Attributes represent the data associated with an object. Each object
has a set of attributes that define its state. These attributes can be of various data
types and may include simple types (integers, strings) or more complex types
(other objects).

12/14/2024 Object-Oriented Database 39


Cont. …
Methods: Methods are functions associated with objects. They define the
behavior or operations that can be performed on objects of a particular class.
Methods encapsulate the functionality related to the object, promoting
encapsulation and modularity.

Encapsulation: Encapsulation is a key principle in object-oriented programming


and is closely tied to object structure. It involves bundling the data (attributes) and
methods that operate on the data within a single unit (the object). Encapsulation
helps in hiding the internal details of an object and exposing only the necessary
interfaces.
12/14/2024 Object-Oriented Database 40
Cont. …
Inheritance: Inheritance is a mechanism that allows the creation of new
classes based on existing ones. It facilitates code reuse and helps in
modeling relationships between classes. Inherited classes share the
attributes and methods of their parent classes.

Relationships: Objects in an OODB can have relationships with other


objects. These relationships are defined by associations between classes and
can include one-to-one, one-to-many, or many-to-many relationships.
Object Structure involves specifying how objects are related to each other.

12/14/2024 Object-Oriented Database 41


Cont. …

• Object Structure in an Object-Oriented Database encompasses the


organization of objects through classes, the definition of attributes and
methods within those classes, encapsulation of data and functionality,
inheritance for code reuse, and the specification of relationships
between objects. This structure is fundamental to the principles of
object-oriented programming and plays a crucial role in designing and
managing data in an OODB.
12/14/2024 Object-Oriented Database 42
Type Constructors

Type Constructors are mechanisms in OODBs that define and create types
or classes. They specify how objects of a particular type should be
constructed, including their attributes and methods.
Type Constructors play a crucial role in the schema definition of the
database. They define the blueprint for creating objects, ensuring
consistency and structure across instances of the same type.
• Type Constructors support features such as inheritance, allowing for the
creation of new types based on existing ones.

12/14/2024 Object-Oriented Database 43


Cont. …

• Here's a breakdown of the significance and features of Type


Constructors in OODBs:

Type Definition: Type Constructors play a crucial role in the


definition of types or classes within an OODB. They provide a means
to specify the structure of objects, including attributes and methods.

• Example: In an OODB, a Type Constructor might be used to define a


"Person" class with attributes such as name, age, and address.

12/14/2024 Object-Oriented Database 44


Cont. …

Attribute Specification: Type Constructors allow the specification of


attributes associated with a class. Attributes represent the data
members or properties of an object.

• Example: For the "Person" class, a Type Constructor would specify


attributes like "name" (string), "age" (integer), and "address" (string).

12/14/2024 Object-Oriented Database 45


Cont. …
Method Declaration: Type Constructors can include the declaration of methods
that define the behavior of objects belonging to a particular class.
• Example: For the "Person" class, a Type Constructor might declare methods like
"getAge()" or "updateAddress()".
Inheritance Support: Type Constructors often support the concept of
inheritance, allowing the creation of new classes based on existing ones. This
promotes code reuse and hierarchical structuring of classes.
• Example: A Type Constructor could enable the creation of a "Student" class that
inherits attributes and methods from the "Person" class.

12/14/2024 Object-Oriented Database 46


Cont. …
Encapsulation and Access Control: Type Constructors contribute to
encapsulation, a fundamental principle of object-oriented
programming. They define the visibility and accessibility of attributes
and methods, supporting the concept of private and public members.

• Example: A Type Constructor might specify that the "age" attribute is


private, accessible only through getter and setter methods.

12/14/2024 Object-Oriented Database 47


Cont. …
Polymorphism: Some Type Constructors support polymorphism,
allowing objects of different classes to be treated as objects of a
common base class. This enhances flexibility and enables more
generic code.

• Example: A Type Constructor might support polymorphic behavior by


allowing objects of various derived classes to be treated uniformly
through a common interface.

12/14/2024 Object-Oriented Database 48


Cont. …

• Type Constructors in Object-Oriented Databases are essential for


defining the structure, behavior, and relationships of objects within the
database. They provide a means for creating and organizing types or
classes, facilitating the modeling of real-world entities and their
interactions. The specific features and syntax of Type Constructors
may vary depending on the OODB system being used.

12/14/2024 Object-Oriented Database 49


Type Hierarchies and Inheritance

• In Object-Oriented Databases (OODBs), type hierarchies and


inheritance play a significant role in organizing and structuring
data. These concepts are closely tied to the principles of object-
oriented programming and contribute to the flexibility, reuse, and
modeling capabilities of the database.

• Here's a closer look at Type Hierarchies and Inheritance in OODB:

12/14/2024 Object-Oriented Database 50


Type Hierarchies
Type hierarchies represent the arrangement of types or classes in a
hierarchical structure. It establishes a relationship between a base type
(parent class) and its derived types (subclasses). Each level in the hierarchy
inherits characteristics from the level above it.
Significance
Inheritance of Characteristics: Types lower in the hierarchy inherit attributes and
behaviors from types higher in the hierarchy.
Organizing Entities: Type hierarchies help in organizing different entities based on
their similarities and differences.

12/14/2024 Object-Oriented Database 51


Cont. …
Base Type (Parent Class): The base type, also known as the parent
class or superclass, is the type from which other types inherit attributes
and methods. It serves as the template for the derived types.

Significance:
Common Characteristics: The base type contains characteristics common to
all its derived types.
Generalization: It allows for the generalization of shared attributes and
behaviors.
12/14/2024 Object-Oriented Database 52
Cont. …

Derived Type (Subclass): The derived type, also known as the


subclass, is a type that inherits attributes and methods from a base
type. It may also introduce new attributes and methods.

Significance:
Specialization: The derived type specializes the base type by adding specific
attributes or behaviors.

 Extension: It extends the functionality of the base type.

12/14/2024 Object-Oriented Database 53


Cont. …
Implementation in OODB:

Type Constructors: Type Constructors in OODB define how types


are constructed, including the specification of attributes and methods.

• They support the creation of types that participate in hierarchies.

Type Inheritance: OODBs support the concept of type inheritance,


allowing for the creation of new types based on existing ones. This
includes inheriting attributes and methods.

12/14/2024 Object-Oriented Database 54


Cont. …
Example:

• Consider a type hierarchy for "Vehicle," where "Car" and


"Motorcycle" are derived types. The base type "Vehicle" may have
attributes like "make" and "model," and methods like "startEngine.“

• The derived types can inherit these attributes and methods and
introduce their own specific attributes.

12/14/2024 Object-Oriented Database 55


Cont. …
• In summary, type hierarchies and inheritance in OODBs provide a
powerful mechanism for organizing and modeling data in a way that
reflects real-world relationships and promotes code reuse.

• These concepts are fundamental to the principles of object-oriented


databases and contribute to their flexibility and adaptability.

12/14/2024 Object-Oriented Database 56


Cont. …
• Key Characteristics:
Object Identity allows individual objects to be uniquely identified
within the database.
It is typically immutable and persists throughout the object's
lifecycle.
Object Identity enables the retrieval, updating, and deletion of
specific objects within the database.

12/14/2024 Object-Oriented Database 57


Cont. …
2. Object Structure:

• Definition: Object Structure refers to the arrangement and


composition of data within an object.

• Example: Continuing with the employee database example, the object


structure of an Employee object may include attributes such as name,
address, salary, and department.

12/14/2024 Object-Oriented Database 58


Cont. …

• Key Characteristics:

Object Structure defines the schema or blueprint for constructing


objects within the database.
It specifies the attributes or properties that characterize each object
type.
Object Structure facilitates the organization and manipulation of
data within objects.
12/14/2024 Object-Oriented Database 59
Cont. …
3. Type Constructors:

• Definition: Type Constructors are mechanisms for defining complex


data types or structures within the database schema.

• Example: In the employee database, a type constructor can define a


custom data type called "Employee" with attributes such as name
(string), age (integer), and department (string).

12/14/2024 Object-Oriented Database 60


Cont. …

• Key Characteristics:
• Type Constructors enable the creation of custom data types that encapsulate
object structures.

• They provide a means for defining classes or types within the database
schema, similar to object-oriented programming.

• Type Constructors facilitate the creation, instantiation, and manipulation of


objects based on defined data types.

12/14/2024 Object-Oriented Database 61


Cont. …

• 4. Type Hierarchies and Inheritance:

• Definition: Type Hierarchies represent the relationships between types in


the database schema, often organized in a hierarchical structure. Inheritance
is a key mechanism in which subtypes inherit attributes and behaviors from
supertypes.

• Type Hierarchies and Inheritance organize types in a hierarchical structure


and enable the reuse of attributes and behaviors through inheritance.

12/14/2024 Object-Oriented Database 62


Cont. …

• Example: In our employee database, we might have a type hierarchy


with a Person supertype and Employee and Manager subtypes. The
Employee subtype inherits attributes and methods from the Person
supertype, such as name and age, while adding its own specific
attributes, such as salary. Similarly, the Manager subtype might further
extend the Employee type with additional attributes like department.

12/14/2024 Object-Oriented Database 63


Cont. …
• Differences:
1.Purpose:
1. Object Identity: Identifies individual objects within the database uniquely.
2. Object Structure: Defines the arrangement and composition of data within objects.
3. Type Constructors: Define custom data types or classes within the database schema.

2.Focus:
1. Object Identity: Focuses on uniquely identifying objects.
2. Object Structure: Focuses on organizing data within objects.
3. Type Constructors: Focus on defining data types for objects.

12/14/2024 Object-Oriented Database 64


Cont. …

• Level of Abstraction:
Object Identity: Represents a low-level detail, identifying
individual objects.
Object Structure: Represents a mid-level detail, specifying the
attributes and properties of objects.
Type Constructors: Represent a higher-level detail, defining
custom data types encapsulating object structures.

12/14/2024 Object-Oriented Database 65


66

You might also like