0% found this document useful (0 votes)
34 views35 pages

Object Databases

Object databases were developed to address inadequacies of relational databases for complex applications involving objects like CAD/CAM systems. Object databases use object-oriented data models and query languages like OQL. Object-relational databases extend relational databases with object features through SQL extensions but still use relational structures. Advantages of object databases include better modeling of real-world entities and relationships.

Uploaded by

James .O. Otieno
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)
34 views35 pages

Object Databases

Object databases were developed to address inadequacies of relational databases for complex applications involving objects like CAD/CAM systems. Object databases use object-oriented data models and query languages like OQL. Object-relational databases extend relational databases with object features through SQL extensions but still use relational structures. Advantages of object databases include better modeling of real-world entities and relationships.

Uploaded by

James .O. Otieno
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/ 35

Object Databases

1
Unit 9
Contents
• Relational DBMS
– Suitability, Complex Applications, Inadequacies
• Data Model Generations
• Types of Object Database
• Object Oriented Databases
– OQL
• Object Relational Databases
– SQL3
– Oracle
• Advantages and Disadvantages

2
Unit 9
Relational DBMS
Suitability
• Relational DBMS are suitable for certain
types of applications
– simple data types, e.g. dates, strings
– large number of instances, e.g. students,
employees
– well defined relationships between data, e.g.
student, course relationships
– short transactions, e.g. simple queries
• Most successful for business applications

3
Unit 9
Complex Applications
• CAD, CAM
– complex objects
– graphics
– a large number of types but few instances of each
type
– hierarchical design not static
• CASE
– software development lifecycle,
– co-operative engineering
– concurrent sharing of design
– code/documentation

4
Unit 9
Complex Applications
• Office Information and Multimedia Systems
– e-mail support
– documentation
– SGML documents
• Geographic Information Systems
– spatial and temporal information, e.g.
satellite/survey photos, maps
– pattern recognition

5
Unit 9
RDBMS Inadequacies
• Poor separation of ‘real world’ entities
– normalisation leads to entities that don’t
closely match real world
– joins costly
• Semantic overloading
– all data held as relationships
– no mechanism for differentiation between
entities and relationships

6
Unit 9
RDBMS Inadequacies
• Poor support for integrity and enterprise
constraints
– relational systems good for supporting referential,
entity and simple business constraints
– not good for more complex enterprise constraints
• Homogeneous data structure
– data pushed into rows and columns
– not all real world data can be organised in this way

7
Unit 9
RDBMS Inadequacies
• Limited operations
– SQL does not allow new operations to be defined
– e.g. select age from person;
• Difficulty handling recursive queries
– e.g. find all ancestors

8
Unit 9
RDBMS Inadequacies
• Impedance mismatch
– need to embed SQL to get computational
completeness
– data types in SQL and programming language don’t
match
• Concurrency, schema changes and poor
navigational access
– no support for long duration transactions
– difficult to change schema, e.g. add columns to a table
– RDBMS based on content based access

9
Unit 9
Data Models

1st Generation

{
Hierarchical

Network

2nd generation Relational

Entity-Relational

Semantic
3rd
generation Object-Relational Object-Oriented

10
Unit 9
Object-Oriented
Databases
• Object-Oriented Database
– e.g. ObjectStore, Objectivity
– based on OO programming techniques
– include concepts such as
• user extensible type system, complex objects,
encapsulation, inheritance, polymorphism, dynamic binding,
object identity
– ODMG standard being devised to define data model
and query language standard
• also defines interoperability between ODMG compliant
systems

11
Unit 9
OQL: Example ODL
Schema
class Student
(extent students)
{
attribute short id;
attribute string name;
attribute string address;
attribute date dob;
relationship set<Module> takes
inverse Module takenby;
short age();
};

12
Unit 9
OQL: Example ODL
Schema
class Module
(extent modules)
{
attribute string title;
attribute short semester;
relationship set<Student> takenby
inverse Student takes;
};

class Postgrad extends Student


(extent postgrads)
{
attribute string thesis_title;
};

13
Unit 9
Object Query
Language
• e.g. select distinct x.age
from Persons x
where x.name = “Pat”;

• Return literal of type set<struct>


select distinct struct(a : x.age, s : x.sex)
from Persons x
where x.name = “Pat”;

14
Unit 9
OQL Examples
• Path Expressions
select c.address
from Persons p, p.children c
where p.address.street = “Main Street”
and count(p.children) >= 2
and c.address.city != p.address.city;
• Methods
select max(select c.age from p.children c)
from Persons p
where p.name = “Paul”;

15
Unit 9
Object-Relational
Databases
• Object-Relational Database
– e.g. Oracle 8, Postgres
– extend relational model with OO features
• e.g. polymorphism, complex objects, extensibility
– but keep relationally based
– SQL99 standard developed as an object-
relational version of SQL92

16
Unit 9
SQL99
• Row types
– a data type that can represent types of rows in tables
– e.g.
CREATE TABLE branch(
bno VARCHAR(3),
address ROW(
street VARCHAR(25),
town VARCHAR(15),
pcode ROW( city_id VARCHAR(4)
subpart VARCHAR(4))));
INSERT INTO branch
VALUES(‘B5’, (‘22 Deer Rd’, ‘Sidcup’, (‘SW1’, ‘4EH’)));

17
Unit 9
SQL99
• UDTs
– abstract data types
– consists of one or more attribute defns
• encapsulation supported
CREATE TYPE person_type AS (
PRIVATE
date_of_birth DATE CHECK(date_of_birth > DATE ‘1990-01-01’);
PUBLIC
fname VARCHAR(15) NOT NULL,
lname VARCHAR(15) NOT NULL,
FUNCTION get_age (P person_type) RETURNS INTEGER
RETURN /* code to calc age */
END; ...
END) NOT FINAL;

18
Unit 9
SQL99
• User defined routines (UDR)
– may be defined as part of a UDT or as part of a
schema
– can be a procedure, function or iterative routine
– Can be written in SQL or in an external
programming language

19
Unit 9
SQL99 Examples
• Querying
– uses SQL92 syntax with extensions to
handle objects
e.g.
SELECT s.lname, s.get_age SELECT p.lname, p.address
FROM staff s FROM person p
WHERE s.is_manager; WHERE p.get_age > 65;

SELECT p.lname, p.address


FROM ONLY (person) p
WHERE p.get_age > 65;

20
Unit 9
SQL99
• Reference Types and OID
– system generated, type REF
– Reference types can be used to define
relationships between row types
– reference types uniquely identify rows
– allows rows to be shared across tables
– complex joins can be replaced by simple path
expressions
– reference types do not provide referential integrity
• Collection types
– ARRAYs, LISTs, SETs, MULTISETs

21
Unit 9
SQL99
• Persistent Stored Modules
– SQL3 now computationally complete
– New statements added:
• Assignment
• IF .. THEN .. ELSE .. ENDIF, and CASE
• REPEAT BLOCKS
• CALL and RETURN for invoking procedures
• Condition handling
• Triggers
– Triggering events include insertion, deletion and
update of rows in a table

22
Unit 9
Oracle 8
• An object-relational extension to Oracle 7
• Object types can be used to create object tables with
object identifiers:
– attributes
– methods
• Does not support table hierarchies
• New types:
– VARRAYs and nested tables
– REFs
– LOBs

23
Unit 9
Object Database
Advantages
• Enriched modelling capabilities
– can model both state and behaviour
– models real world more naturally
• Extensibility
– ability to build new types and use in system
– abstract data types
• Removal of impedance mismatch
– single language interface between DML and
programming language
– computationally complete

24
Unit 9
Object Database
Advantages
• More expressive query language
– support for navigational queries
– support for methods
• Support for schema evolution
– tight coupling between data and applications
– generalisation, inheritance
• Support for long duration transactions
– RDBMS enforce serializability

25
Unit 9
Object Database
Advantages
• Applicability to advanced database
applications
– CAD, CAM, GIS, etc.
• Improved performance
– improved performance for engineering problems
– but different type of problem

26
Unit 9
Object Database
Disadvantages
• Lack of universal data model
– RDBs based on set theory
– OODBs lack theoretical basis
• Lack of experience
– limited use
– steep learning curve
– geared towards programmers rather than typical
users
• Lack of standards
– ODMG standard evolving for standard data model
and standard query language

27
Unit 9
Object Database
Disadvantages
• Query optimisation compromises
encapsulation
– need to break encapsulation to optimise queries
– e.g. access a private attribute to speed-up query
• Locking at object level may impact
performance
– e.g. locking large inheritance hierarchies
• Complexity
– expensive
– difficult to use
28
Unit 9
Object Database
Disadvantages
• Lack of support for views
– an important concept in RDBs
– provide customisable views of a database
• Lack of support for security
– no views
– coarse granularity
– difficult to grant access rights on individual
objects/classes

29
Unit 9
Object-Relational
Advantages
• Weaknesses of RDBMS
• Reuse and Sharing
– extending the DBMS server to perform standard
functionality centrally
– functionality shared by all applications
• Evolutionary rather than revolutionary
– SQL3 upwardly compatible with current SQL
standard

30
Unit 9
Object-Relational
Disadvantages
• Complexity and Associated Increased Costs
– simplicity and purity of relational model is lost
– majority of applications do not achieve optimal
performance
• Semantic gap between object-oriented and
relational
– OO applications not as data centric as Relational
• Objectives of Initial SQL standard were to
minimise user effort and be easy to learn
31
Unit 9
Why more than one
model?
• Stonebraker proposed a four quadrant view
of the database world:

Relational Object-
DBMS Relational
DBMS
Search capabilities/ File systems Object-
Oriented
multi-user support DBMS

Data complexity/extensibility

32
Unit 9
Summary
• More than one data model, but each model
good for particular types of application
• Each has its own advantages and
disadvantages
• Object-Relational DBMS are taking over
Relational DBMS in market place
– e.g. Oracle 8
• Object-Oriented still have their own niche

33
Unit 9
Further Reading
• Connelly and Begg, chapters 21-23
– a very good introduction to object-oriented and
object-relational databases
• Cattell, et. al. The Object Data Standard, 3rd
ed.
– Discusses the ODMG standard for object
databases

34
Unit 9
Further Reading
• Stonebraker, Object-Relational Databases:
The Next Great Wave
– written by the person who produced the first
object-relational database Postgres

35
Unit 9

You might also like