0% found this document useful (0 votes)
2 views

Chapter 1 Odbms Concepts

The document provides an overview of Object-Oriented Database (OODB) concepts, emphasizing the advantages of using object models over traditional relational databases. It discusses key features of OODBs, including powerful type systems, encapsulation, inheritance, and object identity, which facilitate the handling of complex data structures. The document also outlines the importance of maintaining a direct correspondence between real-world objects and their database representations.

Uploaded by

Woldeab Bisrat
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Chapter 1 Odbms Concepts

The document provides an overview of Object-Oriented Database (OODB) concepts, emphasizing the advantages of using object models over traditional relational databases. It discusses key features of OODBs, including powerful type systems, encapsulation, inheritance, and object identity, which facilitate the handling of complex data structures. The document also outlines the importance of maintaining a direct correspondence between real-world objects and their database representations.

Uploaded by

Woldeab Bisrat
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 40

Advanced Database system

Chapter one:
Object Oriented
Database Concept
Prepared by:
Misganaw Abeje
University of Gondar
College Of Informatics
Department of computer science
[email protected]
Outline

 Overview of database and database model


 Object oriented database
 FEATURE Object oriented database
 Object Structure
 Complex Objects

BY: MA
Overview of Database and data model

 A database is a an organized collection of related data


held in a computer or a data bank, which is designed to be
accessible in various ways.
 The data within a database is structured so as to model a
real world structures and hierarchies so as to enable
conceptually convenient data storage, processing and
retrieval mechanisms
 Clients (Services or applications) interact with databases
through queries (remote or otherwise) to Create, Retrieve,
Update and Delete (CRUD) data within a database. This
process is facilitated through a Database Management
BY: MA System (DBMS)
Data Models

 The type of a database is decided by the data model


used in the design of the database.
 Data models are data structures which describe how data
are represented and accessed. Data models must be
simple and intuitive to enable applications.
 The major types of data models in the history of
Databases are:
– Hierarchical model
– Network Model Reading Assignment
– Relational Model
– Object Model
BY: MA
Cont.…

 Relational Models have been quite successful in developing the


database technologies required for many traditional business
database applications.
 Relational models were limiting in the kind of data that could
be held, the rigidity of the structure, and the lack of support for
new data types such as graphics, xml, 2D and 3D data, and for
more complex database applications must be designed and
implemented.
– Eg, databases for engineering design and manufacturing (CAD/CAM
and CIM1), scientific experiments, telecommunications, geographic
information systems, and multimedia applications.
BY: MA
Cont.…

 Relations are the key concept:


– Everything else is around relations
– Primitive data types, e.g., strings, integer, date, etc.
– Great normalization, query optimization, and theory
 What is missing?
 Handling of complex objects
 Handling of complex data types
 Code is not coupled with data
 No inheritance, encapsulation, etc.
BY: MA
Object model

 Object Model aims to reduce the overhead of converting


information representation in the database to an
application specific representation.
 Unlike a traditional database, an object model allows for
data persistence and storage by storing objects in the
databases.
 The relationships between various objects are inherent in
the structure of the objects. This is mainly used for
complex data structures such as 2D and 3D graphics
which must otherwise be flattened before storage in a
relational database.
BY: MA
Object-Oriented Database

 In the 1980s With the advent of Object Oriented


methodologies and languages, integration of database
capabilities with object oriented programming language
provided a unified programming environment. This led to the
development of OODB and OODBMS where objects are
stored in databases rather than data such as integers, strings or
real numbers.
 The key feature of object-oriented databases is the power they
give the designer to specify both the structure of complex
objects and the operations that can be applied to these
objects.

BY: MA
Cont…

 Object oriented databases or object databases


incorporate the object data model to define data
structures on which database operations such as CRUD
can be performed. They store objects rather than data
such as integers and strings.
 The relationship between various data is implicit to the
object and manifests as object attributes and methods
 Object database management systems extend the object
programming language with transparently persistent data,
concurrency control, data recovery, associative queries,
and other database capabilities.
BY: MA
 The Object-Oriented Database System Manifesto by
Malcolm Atkinson mandates that an object oriented
database system should satisfy two criteria:
– it should be a DBMS, and
– it should be an object-oriented system
 Thus OODB implements OO concepts such as object
identity ,polymorphism, encapsulation and inheritance to
provide access to persistent objects using any OO-
programming language

BY: MA
Object-Orientation Concepts
 Class: is a design or a blue print of any entity, its
Collection of objects is called class.
 Object: an instance of a class which has a physical
existence or a real-world entity.
 Abstraction: Hiding internal details and showing functionality, only
shows relevant data.
 Encapsulation: Binding (or wrapping) code and data together into
a single unit are known as encapsulation.
 Polymorphism: If one task is performed in different ways, by using
the methods overloading and overriding.
 Inheritance: When one object acquires all the properties and
behaviors of a parent object, it is known as inheritance. It provides
BY: MA code reusability. It is used to achieve runtime polymorphism.
Why Object-Oriented Databases?

 Reasons for creation of Object Oriented Databases


• Need for more complex applications in current
technology application
• Need for additional data modeling features
• To overcome powerful or user defined data
types
• OOP(object oriented programming) uses the
object directly from database.
• Increased use of object-oriented programming
languages
BY: MA • OO Database products is now Commercial
What is Object-Oriented Data Model?

 OO databases try to maintain a direct


correspondence between real-world and database
objects so that objects do not lose their integrity
and identity and can easily be identified and
operated upon.
 Relations are not the central concept, classes and
objects are the main concept.
 Main Features:
1. Powerful Data type system
2. Object-oriented concept
3. Object Identity
BY: MA
FEATURE 1: POWERFUL TYPE SYSTEM

 Primitive types : Integer, string, date, Boolean,


float, etc.
 Structure type : Attribute can be a record with a
schema, struct { integer x, string y}
 Collection type : Attribute can be a Set, Bag, List,
Array of other types
 Reference type: Attribute can be a Pointer to
another object
 OODBMS are capable of storing complex objects, I.e.,
objects that are composed of other objects, and/or
BY: MA
FEATURE 2: O-O Concepts
1. CLASSES
 A ‘class’ is in replacement of ‘relation’
 Same concept as in OO programming languages
 All objects belonging to a same class share the same
properties and behavior
 An ‘object’ can be thought of as ‘tuple’ (but richer content)
 An object is made of two things:
– State: attributes (name, address, birthDate of a person)
– Behavior: operations (age of a person is computed from
birthDate and current date)
 Classes encapsulate data + methods + relationships
 Unlike relations that contain data only
 In OODBMSs objects are persistent (unlike OO programming
BY: MA
2: INHERITANCE

 When one object acquires all


the properties and behaviors of
a parent object, It provides code
reusability. It is used to achieve
runtime polymorphism
 Person is super-class and
Student is sub-class.
 Student class inherits
attributes and operations of
Person.
BY: MA
3. Encapsulation
 Encapsulation in the object model concept allows for including
processing or behavior with the object instances defined by the
class. This allows code and data to be packaged together Binding
(or wrapping) .
 The encapsulation is achieved through objects and its
operations.
 Encapsulation - Structure of an object is not visible to the external
world
 To encourage encapsulation, all operations on an object are
predefined
 signature or interface of the operation, specifies the operation
name and arguments (or parameters).
 method or body, specifies the implementation of the operation.
BY: MA
Cont…

 Operations can be invoked by passing a message


to an object, which includes the operation
name and the parameters.
 This encapsulation permits modification of the
internal structure of an object, as well as the
implementation of its operations, without the
need to disturb the external programs that
invoke these operations.
 External users only have access to the interface of the object
(signature) which defines the names and types of all
parameters to each operation
BY: MA
4. Polymorphism
 This refers to an operation’s ability to be applied to
different types of objects; in such a situation, an
operation name may refer to several distinct
implementations, depending on the type of objects it is
applied to.
 Operator overloading: It allows the same operator
name or symbol to be bound to two or more different
implementations of the operator, depending on the
type of objects to which the operator is applied
– For Example ‘+’ can be :
 Addition in integers
 Concatenation in strings (of characters)
BY: MA
FEATURE 3: OBJECT IDENTITY

 OID is a unique, unchangeable object identifier


generated by the OO system regardless of its
content
 Independent of the values of the object attributes
 Invisible to the user
 Used for referencing objects
 Two objects are identical if they have the same
identity of the object - property that uniquely
identifies them
 Even if all attributes are the same, still objects have
BY: MA
Feature 4: Object Structure

 The main features of Object oriented database is


used handle complex object.
 Complex data objects allow you to create data structures that
group together different types of data. Complex data objects
are based on complex data types.
 Complex data types allow you to create data structures based
on basic data objects (primitive data types)
 Every instance of an object is characterized by its
state.
 Structure of an object instance is represented by a
triple: (i, c, v) where I : object identifier, c : type
BY: MA constructor, v : object state or value
Complex Type Structures for Objects and
Literals

 The feature of an ODMS (and ODBs in general) is that


objects and literals may have a type structure of arbitrary
complexity in order to contain all of the necessary
information that describes the object or literal.
 In contrast, in traditional database systems, information about
a complex object is often scattered over many relations or
records, leading to loss of direct correspondence between a
real-world object and its database representation.
 In OODB, the value of a complex object can be constructed
from other objects by applying constructors to them.

BY: MA
Type Constructors

 In OO databases, the state (current value) of a complex object may


be constructed from other objects (or other values) by using certain
type constructors.
 Type constructors is determine how the object is constructed.
 The three most basic constructors are atom, tuple and set.
 Other commonly used constructors include list, bag, and array.
 The atom constructor is used to represent all basic atomic values,
such as integers, real numbers, character strings, Booleans, and any
other basic data types s(primitive) that the system supports directly.
They are called single-valued or atomic types, since each value of
the type is considered an atomic (indivisible) single value.
BY: MA
Cont…

 The set type constructor represents a set of OIDs


{ i1,i2,...,in}, which are the OIDs of objects of typically of
same type with duplication . Eg { 123,256,123,468},
 The bag is similar same as set but bag has no
duplicate elements.eg { 123,256,248,468},
 List type constructor represent the ordered list of OIDs of
the same type. [12 24 56 456]
 Array type constructor is single dimension array of
OIDs.
 The main difference between list and array is that a
list can have an arbitrary number of element
BY: MA
Struct (or Tuple)

 A structured or tuple is a collection of other type constructor.


type is made up of several components, and is also sometimes
referred to as a compound or composite type.
 For example, two different structured types that can be created
are: struct Name<FirstName: string, MiddleInitial: char,
LastName: string>, and struct CollegeDegree<Major: string,
Degree: string, Year: date>.
 The tuple constructor can create structured values and objects
of the form <a1:i1, a2:i2, ..., an:in>, where each an is an
attribute name and each In is a value or an OID.

BY: MA
 Formal definition:
1. Every atomic value in A is an object.
2. If a1, ..., an are attribute names in N, and Example:
O1, ..., On are objects, then T = [a1:O1, ..., (i1, atom, 'John')
an:On] is also an object, and T.ai retrieves the (i2, atom, 30)
value Oi. (i3, atom, 'Mary')
3. If O1, ..., On are objects, then S = {O1, ..., On} (i4, atom, 'Mark')
(i5, atom 'Vicki')
is an abject.
(i6, tuple, [Name:i1, Age:
 Example1: {[Name:John, Age: 30], (i7, set, {i4, i5})
[Name:Mary, Friends:{Mark, Vicki}]} (i8, tuple, [Name:i3, Frien
 An object is defined by a triple (OID, type (i9, set, {i6, i8})
constructor, state) where OID is the unique
object identifier, type constructor is its type
(such as atom, tuple, set, list, array, bag, etc.)
BY: MA
Object Identity, Object Structure, and
Type Constructors

 Example 1
 One possible relational database state
corresponding to COMPANY schema

BY: MA
Example1:cont…

BY: MA
Example1:cont…

BY: MA
Object Identity, Object Structure, and
Type Constructors

 Example2(contd.)
 We use i1, i2, i3, . . . to stand for unique system-
generated object identifiers. Consider the following
objects:
 o1 = (i1, atom, ‘Houston’)
 o2 = (i2, atom, ‘Bellaire’)
 o3 = (i3, atom, ‘Sugarland’)
 o4 = (i4, atom, 5)
 o5 = (i5, atom, ‘Research’)
 o6 = (i6, atom, ‘1988-05-22’)
BY: MA  o = (i , set, {i1, i2, i3})
Object Identity, Object Structure, and
Type Constructors

 Example 1(contd.)
 o8 = (i8, tuple, <dname:i5, dnumber:i4, mgr:i9,
locations:i7, employees:i10, projects:i11>)
 o9 = (i9, tuple, <manager: i12, manager_start_date:i6>)
 o10 = (i10, set, {i12, i13, i14})
 o11 = (i11, set {i15, i16, i17})
 o12 = (i12, tuple, <fname:i18, minit:i19, lname:i20,
ssn:i21, . . ., salary:i26, supervisor:i27, dept:i8>)
 ...
BY: MA
Object Identity, Object Structure, and
Type Constructors

 Example 1 (contd.)
– The first six objects listed in this example
represent atomic values.
– Object seven is a set-valued object that
represents the set of locations for department
5; the set refers to the atomic objects with
values {‘Houston’, ‘Bellaire’, ‘Sugarland’}.
– Object 8 is a tuple-valued object that
represents department 5 itself, and has the
attributes DNAME, DNUMBER, MGR,
BY: MA
LOCATIONS, and so on.
Object Identity, Object Structure, and
Type Constructors

BY: MA
Object Structure and Type
Constructors

BY: MA
Persistence of Objects

 Persistent objects are the objects that are created and


stored in database and exist even after the program
termination.
 Typical mechanisms for making an object persistence
are: Naming and Reachability.
• Naming Mechanism: Assign an object a unique
persistent name through which it can be retrieved by
this and other programs.
• 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.
BY: MA
Specifying Object Persistence via Naming and
Reachability

 An ODBS is often closely coupled with an object-oriented


programming language (OOPL).
 The OOPL is used to specify the method (operation)
implementations as well as other application code.
 Not all objects are meant to be stored permanently in the
database.
 Transient objects exist in the executing program and
disappear once the program terminates.
 Persistent objects are stored in the database and persist after
program termination. The typical mechanisms for making an
BY: MA
object persistent are naming and reachability.
Cont…

 The naming mechanism involves giving an


object a unique persistent name within a particular
database.
 Obviously, it is not practical to give names to all
objects in a large database that includes
thousands of objects, so most objects are made
persistent by using the second mechanism, called
reachability. T
 The reachability mechanism works by making the
object reachable from some other persistent
object.
BY: MA
Complex Objects

 Unstructured complex object:


– These is provided by a DBMS and permits the storage and
retrieval of large objects that are needed by the database
application.
– Typical examples of such objects are bitmap images and long
text strings (such as documents CLOB); they are also known
as binary large objects, or BLOBs for short.
– Eg: image, BLOBs(1MB)
– Document, CLOBs(10KB)

BY: MA
Complex Objects: Structured complex
object

 This differs from an unstructured complex object in that the object’s structure
is defined by repeated application of the type constructors provided by the
OODBMS.
 Hence, the object structure is defined and known to the OODBMS.
 The OODBMS also defines methods or operations on it.
 For example: The DEPARTMENT object is structured object.
– define type DEPARTMENT
– tuple ( Dname: string;
– Dnumber: integer;
– Mgr: tuple ( Manager: EMPLOYEE;
– Start_date: DATE; );
– Locations: set(string);
– Employees: set(EMPLOYEE);
BY: MA
 THANK YOU !

You might also like