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

7 Chapter Seven

Uploaded by

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

7 Chapter Seven

Uploaded by

Beyenech Ashiye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 27

Chapter seven

Object-Oriented DBMSs
Weaknesses of RDBMSs

• Poor Representation of “Real World” Entities


– Normalization leads to relations that do not
correspond to entities in “real world”.

• Semantic Overloading
– Relational model has only one construct for
representing data and data relationships: the
relation.
– Relational model is semantically overloaded.

2
Weaknesses of RDBMSs

• Poor Support for Integrity and Enterprise


Constraints

• Homogeneous Data Structure


– Relational model assumes both horizontal and
vertical homogeneity.
– Many RDBMSs now allow Binary Large Objects
(BLOBs).

3
Weaknesses of RDBMSs

• Limited Operations
– RDBMs only have a fixed set of operations
which cannot be extended.

• Difficulty Handling Recursive Queries


– Extremely difficult to produce recursive queries.
– Extension proposed to relational algebra to
handle this type of query is unary transitive
(recursive) closure operation.

4
Weaknesses of RDBMSs

• Impedance Mismatch
– Most DMLs lack computational completeness.
– To overcome this, SQL can be embedded in a
high-level 3GL.
– This produces an impedance mismatch -
mixing different programming paradigms.
– Estimated that as much as 30% of
programming effort and code space is
expended on this type of conversion.

5
Weaknesses of RDBMSs

• Other Problems with RDBMSs


– Transactions are generally short-lived and
concurrency control protocols not suited for
long-lived transactions.
– Schema changes are difficult.
– RDBMSs are poor at navigational access.

6
What is an OODBMS ?
OODBMS (Object-oriented Database Management System): is a
database with data stored in objects and collections NOT rows and
tables.
Object Oriented Concepts:

 Abstraction, encapsulation, and information hiding.


 Objects and attributes.
 Object identity.
 Methods and messages.
 Classes, subclasses, superclasses, and inheritance.
 Overriding, Overloading, Polymorphism and Dynamic Binding.

OODBMS 7
OODBMS

Traditional DBS Semantic Data Model OO Programming


Special Requirements
•Persistence •Generalization •OID
•Versioning
•Sharing •Aggregation •Encapsulation
•Schema Evolution
•Transactions •Inheritance
•Concurrency Control •Types & Classes
•Recovery Control •Methods
•Security •Complex objects
•Integrity •Polymorphism
•Querying •Extensibility

OODBMS

OODBMS Origins of object oriented data model 8


Abstraction
•Abstraction is the process of identifying
essential aspects of an entity and ignoring
unimportant properties.
•Concentrate on what an object is and what
it does, before deciding how to implement it.

OODBMS 9
Encapsulation & Information Hiding
Encapsulation: means that an object contains both data
structure and set of operations used to manipulate it.

Information Hiding: means separating external aspects of


an object from its internal details, which are hidden from
outside.

• Allows internal details of an object to be changed without


affecting applications that use it, provided external details
remain same.

• Provides data independence.


OODBMS 10
Objects
Object is a uniquely identifiable entity that contains both:
• the attributes that describe the state of a real-world object,
• and the actions associated with it.

Definition very similar to that of an entity, however, Object


encapsulates both state and behavior; an entity only models
state.

Persistent Objects vs. Transient Objects:


• Transient: object’s memory allocated and deallocated by
programming language’s runtime system.
• Persistent: object’s storage managed by OODBMS.

OODBMS 11
Attributes
Attributes contain current state of an object:

• Attributes can be classified as simple or complex.

• Simple attribute can be a primitive type such as integer,


string, etc., which takes on literal values.

• Complex attribute can contain collections and/or


references.

• Reference attribute represents relationship.

• An object that contains one or more complex attributes is


called a complex object.

OODBMS 12
Object Identity (OID)
Object identifier (OID) assigned to object when it is
created that is:
• System-generated.
• Unique to that object.
• Invariant (Stable).
• Independent of the values of its attributes (that is,
its state).
• Invisible to the user (ideally).

OODBMS 13
Object Identity (OID)
In RDBMS, entity identity is value-based: primary
key is used to provide uniqueness.

Primary keys do not provide type of object identity


required in OO systems:
• key only unique within a relation, not across
entire system;
• key generally chosen from attributes of relation,
making it dependent on entity state.

OODBMS 14
Methods & Messages

Method: Defines behavior of an object, as a set of


encapsulated functions.

Message: Request from one object to another


asking second object to execute one of its methods.

OODBMS 15
Object Showing Attributes & Methods

Method 1 Method 2

Attributes

Method 4 Method 3

OODBMS 16
Classes

Classes are blueprints for defining a set of


similar objects.
• Objects in a class are called instances.

• Class is also an object with own class attributes and


class methods.

• Object created from the same class share the same


class attributes and methods.

OODBMS 17
Class Instance Share Attributes & Methods
BranchNo = B005
Street = 22 Deer Rd
City = London
Postcode = SW1 4EH

BRANCH
Attributes
branchNo BranchNo = B007
street Street = 16 Argyll St
city
postcode City = Aberdeen
Postcode = AB2 3SU
Methods

print()
getPostCode()
numberOfStaff() BranchNo = B003
Street = 163 Main St
City = Glasgow
Postcode = G11 9QX

OODBMS 18
Subclasses, Superclasses, &
Inheritance
Inheritance allows one class of objects to be defined as a
special case of a more general class.
•Special cases are subclasses and more general cases are
superclasses.

•Process of forming a superclass is generalization; forming a subclass is


specialization.

•Subclass inherits all properties of its superclass and can define its own
unique properties.

•Subclass can redefine inherited methods (overriding).

•Relationship between subclass and superclass known as A KIND OF


(AKO) relationship.

OODBMS 19
Subclasses, Superclasses, &
Inheritance
Types of inheritance: single, multiple, and repeated.

Single Inheritance Multiple Inheritance Repeated Inheritance

OODBMS 20
Overriding, Overloading &
Polymorphism
Overriding is the process of redefining a property within a
subclass.

Overloading allows name of a method to be reused with a class


or across classes.

Polymorphism means ‘many forms’. Three types: operation,


inclusion, and parametric.

The process of selecting the appropriate method based on an


object’s type is called binding.
• If the determination of an object’s type can be deferred until runtime
(rather than compile time), the selection is called dynamic binding.

OODBMS 21
Complex Objects
A Complex object is something that can be viewed as a single object
in the real world but it actually consists of many sub-objects.

Two types of complex objects:

•Unstructured complex objects:


• Their structure hard to determine.
• Requires a large amount of storage.
• BLOB (Binary Large Objects): images & long test strings.

•Structured complex objects:


• Clear structure.
• Sub-objects in A PART-OF (APO) relationship.

OODBMS 22
Unified Modeling Language (UML)

UML is a standard language for specifying, constructing, visualizing, and


documenting the artifacts of a software system.

•Include many structural diagrams (Class, Object diagrams…) and behavioral


diagrams (UseCase, Sequence diagrams…).
•Used to model objects and object relationships.

Class Name MANAGER Association PROPERTY


StaffNo PropertyNo
Attribute
sex 1..1 manage 1.1 1..1 offer 1.* street
DOB
salary offered-by city
postcode
increasesalary() rooms
Method type

OODBMS 25
Unified Modeling Language (UML)
PERSON
Name
FName
LName

STAFF POWNER CLIENT


ClientNo
StaffNo OwnerNo telNO
position address prefType
DOB MaxRent
salary 1
OwnedBy N
Owns ViewedBy Views
M PROPERTY M
MANAGER SALESTAFF
PropertyNo
rooms
rent
1 M WorksAt M
Has 1
Manages 1 BRANCH 1 Offers
ManagedBy BranchNo IsOfferedBy
address

OODBMS 26
Object Query Language (OQL)
Object Query Language OQL is a query language for
OODBMS.
• Does not provide explicit update operators - leaves this to
operations defined on object types.

OQL can be used for both associative and navigational access:

• Associative query returns collection of objects (like SQL).

• Navigational query accesses individual objects and object


relationships used to navigate from one object to another.

OODBMS 27
Object Query Language (OQL)
OQL vs. SQL A Simple Example: List the names of the children of
employees working in the sales department.

OQL SQL
select select
c.fname, c.lname c.fname, c.lname
from from
Department d, d.Employee e, Department d, Employee e,
e.Children c Children c
where where
d.name = “Sales”; d.name = “Sales” and
d.deptID = e.deptID and
c.parentID = e.empID;

OODBMS 28
• Next chapter (Data Mining and Warehousing)

OODBMS 29

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy