CS263

1 / 64
About This Presentation
Title:

CS263

Description:

TIRE: STRING. HUB CAP: STRING. TRIM: STRING. SEAT. TYPE: STRING ... Apply Trade Discount. SUPER-CLASS. SUB-CLASS. IS-A. Object Model. WHAT IS LATE BINDING? ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 65
Provided by: computing97

less

Transcript and Presenter's Notes

Title: CS263


1
  • OBJECT DATABASE SYSTEMS
  • PART ONE
  • Advanced database application areas
  • Problems associated with RDBMSs
  • Third Generation DBMSs
  • What is Object Orientation?
  • What is an OODBMS?

2
  • DATABASES
  • Computer-Aided Design (CAD).
  • Computer-Aided Manufacturing (CAM).
  • Computer-Aided Software Engineering (CASE).
  • Multimedia Systems.
  • Digital Publishing.
  • Geographic Information Systems (GIS).
  • Scientific and Medical Systems.

ADVANCED APPLICATION AREAS
3
  • RELATIONAL DBMSs
  • Poor representation of real world entities.
  • Semantic overloading.
  • Homogeneous data structure.
  • Difficulty handling recursive queries.
  • Impedance mismatch.

PROBLEMS
4
RELATIONAL DBMSs
PROBLEMS - REAL-WORLD OBJECTS
ER Diagram - Car
5
RELATIONAL DBMSs
PROBLEMS - REAL-WORLD OBJECTS
NORMALISATION
To find out all details about a Car we would have
to carry out a large number of (expensive) JOIN
operations.
Select From Car, Wheel, Trim, Seat Where
Car.C Wheel.C And Car.C Seat.C And
Wheel.W Trim.W
6
RELATIONAL DBMSs
PROBLEMS - SEMANTIC OVERLOADING
ER Diagram
Doctor D, Name, Surgery, etc Patient P, D,
Name, Address, DOB, etc
7
RELATIONAL DBMSs
PROBLEMS - HOMOGENEOUS DATA STRUCTURE
ACCOUNT TABLE
BALANCE
BRANCH
CUSTOMER
ACCOUNT
1000.00
STRATFORD
JONES
200
200.00
BARKING
GRAY
324
23.17
STRATFORD
SMITH
345
340.14
BARKING
GREEN
350
500.00
BARKING
ONO
400
333.00
STRATFORD
KHAN
456
ALL ROWS HAVE THE SAME NUMBER OF ATTRIBUTES ALL
VALUES IN A COLUMN ARE OF THE SAME TYPE ALL
ATTRIBUTE VALUES ARE ATOMIC
8
RELATIONAL DBMSs
PROBLEMS - RECURSIVE QUERIES
Question - Who does SMITH work for?
9
(No Transcript)
10
  • Support Complex Active Objects
  • Allow both data and its associated behaviour
    to be
  • modelled to any level of complexity.
  • Improve Extensibility
  • Allow for the dynamic extension of both
    allowable data
  • types and the behaviour associated with
    these types.
  • Reduce the Impedance Mismatch
  • Ensure that there is a seamless integration
    between the
  • DBMS data model and that of the programming
    language
  • accessing the data.

11
Object Model
WHAT IS AN ATOMIC (LITERAL) OBJECT?
An atomic object is a container for a fixed value
and serves the same purpose as a constant in a
programming language. An atomic object cannot
change its own state.
12
(No Transcript)
13
(No Transcript)
14
I am a Person!
15
  • Each object is uniquely identifiable from all
    other objects. When an object is first created it
    is assigned a value to identify it. This value is
    called its Object Identifier.
  • System generated.
  • Unique to that object.
  • Invariant in that it cannot be altered.
  • Independent of its attribute values.
  • Invisible to the user.

16
OBJECT
NAME MARK DOB 14/02/64 JOB LECTURER
CHANGE JOB METHOD
17
Yes, its an object that is made up of other
objects! Wheels, Seats, Chassis, Exhaust,
Steering Wheel, etc, etc...
And a wheel itself is also a complex
object! Tire, Trim, Hub Cap, etc, etc...
18
Object Model
WHAT IS A COMPLEX OBJECT?
CAR
19
Object Model
WHAT IS A COMPLEX OBJECT?
A Wheel IS-PART-OF a Car
REGISTRATION NUMBER
SEAT
SEAT
CAR
CHASSIS
SEAT
SEAT
A Car has a COLLECTION of Wheels
20
Object Model
WHAT IS A COMPLEX OBJECT?
CAR REG-NUMBER STRING CHASSIS STRING WHEELS S
ET SEATS SET
21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
(No Transcript)
25
A fixed number of named slots, each of which can
contain an object of a particular type. e.g,
CustomersDetails STRUCTURE
List , family_name String,
customer_no Integer
26
Person
name
address
telephone_no
change_name (...)
change_address (...)
Employee
Customer
employee_no
customer_no
promote(...)
place_order(...)
pay_employee (...)
make_payment(...)
TradeCustomer
trade_discount
place_order(...)
make_payment(...)
27
Person
name
address
telephone_no
change_name (...)
change_address (...)
Employee
Customer
employee_no
customer_no
promote(...)
place_order(...)
pay_employee (...)
make_payment(...)
Employee_Customer
TradeCustomer
staff_discount_card
trade_discount
place_order(...)
place_order(...)
make_payment(...)
make_payment(...)
28
(No Transcript)
29
OBJECT
GET AGE METHOD BODY
GET AGE MESSAGE
NAME MARK DOB 14/02/64 JOB LECTURER
USER PROGRAM
CHANGE JOB METHOD BODY
CHANGE JOB MESSAGE
DISK
30
DIFFERENT TYPES OF OBJECT RESPOND DIFFERENTLY
TO THE SAME MESSAGE
31
When a sub-classs method body is used rather
than the body of the super-classs method it is
known as overriding.
METHOD BODY 1. Create order details 2. Calculate
total cost
SUPER-CLASS
IS-A
METHOD BODY 1. Create order details 2. Calculate
total cost 3. Apply Trade Discount
SUB-CLASS
32
Late or dynamic binding is the ability of the
runtime system to determine which method body to
execute depending on the type of an object.
It doesnt matter if a customer is a trade
customer, late binding ensures the appropriate
PLACE_ORDER method body is called!
33
Object Oriented Database Management Systems
(OODBMSs) are an attempt at marrying the power of
Object Oriented Programming Languages with the
persistence and associated technologies of a
DBMS.
OBJECT ORIENTED DATABASE MANAGEMENT SYSTEM
34
(No Transcript)
35
  • LECTURE PLAN
  • OBJECT DATABASE SYSTEMS
  • PART TWO
  • What is an OODBMS?
  • Advantages and Disadvantages of OODBMSs
  • What is an ORDBMS?
  • What is SQL3?
  • Comparison of OODBMSs and ORDBMSs
  • When to use an OODBMS
  • When to use an ORDBMS

36
  • OODBMSs
  • Requirements
  • Transparently add persistence to OO programming
    languages
  • Ability to handle complex data - i.e., Multimedia
    data
  • Ability to handle data complexity - i.e.,
    Interrelated data items
  • Add DBMS Features to OO programming languages
  • Features
  • The host programming language is also the DML.
  • The in-memory and storage models are merged.
  • No conversion code between models and languages
    is needed.

REQUIREMENTS AND FEATURES
37
TWO-LEVEL STORAGE MODEL FOR A RDBMS
Main or virtual
memory
Transforming and
type checking
SQL
Secondary
storage
38
ACCESSING A RECORD USING AN RDBMS
Page
Application memory
Record
Page
DBMS Cache
Record
Page
Secondary Storage
Record
39
SINGLE-LEVEL STORAGE MODEL FOR AN OODBMS
40
ACCESSING AN OBJECT USING AN OODBMS
Page
3. Access object
2. Swizzle pointers, etc.
Application memory
4. Swizzle pointers back, etc.
Object
5. Save page
1. Read page
Page
Secondary Storage
Object
41
  • OODBMSs
  • Enriched modelling capabilities
  • Extensibility
  • Removal of Impedance Mismatch
  • Support for schema evolution.
  • Applicable for advanced database applications
  • Improved performance.

ADVANTAGES
42
  • OODBMSs
  • Lack of a universal data model
  • Lack of experience
  • Lack of standards.
  • Ad-hoc querying compromises encapsulation.
  • Locking at object-level impacts performance
  • Complexity
  • Lack of support for views
  • Lack of support for security

DISADVANTAGES
43
  • ORDBMSs
  • Definition
  • Object-Relational databases extend the Relational
    Data Model to address those weaknesses identified
    previously.
  • An Object-Relational database adds features
    associated with object-oriented systems to the
    Relational Data Model.

WHAT IS AN ORDBMS?
In essence ORDBMSs are an attempt to add OO to
Tables!
44
ORDBMSs
MAJOR DIFFERENCE BETWEEN AN ORDBMS AND AN OODBMS
OODBMSs try to add DBMS functionality to one or
more OO programming languages.
REVOLUTIONARY IN THAT THEY ABANDON SQL
ORDBMSs try to add richer data types and OO
features to a relational DBMS.
EVOLUTIONARY IN THAT THEY EXTEND SQL
45
  • ORDBMSs
  • SQL3 or SQL/99
  • SQL3 is a superset of SQL/92, in that it supports
    all of the constructs supported by that standard,
    as well as adding new ones of its own.
  • Therefore, whatever worked in an implementation
    of SQL/92 should also work in an implementation
    of SQL3.

WHAT IS SQL3?
HOWEVER, IT SHOULD BE NOTED THAT AS YET THERE ARE
NO IMPLEMENTATIONS OF SQL3!
46
  • ORDBMSs
  • Extended Base Types.
  • Row Types.
  • User-Defined Types.
  • User-Defined Routines.
  • Sub-Types and Super-Types.
  • Sub-Tables and Super-Tables.
  • Reference Types and Object Identity.

WHAT IS NEW IN SQL3?
47
ORDBMSs
SQL3 - EXTENDED BASE TYPES
ONE OF THE REASONS FOR THE MOVE AWAY FROM RDBMSs
IS THE LIMITED BASE TYPE AVAILABILITY
BASE TYPES AVAILABLE IN SQL/92 INCLUDE NUMBER,
CHAR, DATE, ...
BASE TYPES IN SQL3 ARE EXTENSIBLE. THEREFORE THE
FOLLOWING MUCH NEEDED TYPES COULD BE ADDED
(PROVIDED SOMEBODY CREATES THEM!) VIDEO, IMAGE,
AUDIO, TEXT, SPATIAL, TEMPORAL, GEOGRAPHIC,
WEB-PAGES, ...
48
ORDBMSs
SQL3 - ROW TYPES
COLUMN ATTRIBUTES NO LONGER HAVE TO BE ATOMIC!
49
ORDBMSs
SQL3 - USER-DEFINED TYPES
CREATE TYPE person_type AS ( PRIVATE date_of_bi
rth DATE CHECK (date_of_birth DATE
1900-01-1901), PUBLIC name VARCHAR(15) NOT
NULL, address VARCHAR(50) NOT
NULL, tel_no VARCHAR(13) NOT NULL, FUNCTION
get_age (P person_type) RETURNS INTEGER
/ code to calculate age from date_of_birth
/ RETURN END) NOT FINAL
50
ORDBMSs
SQL3 - SUB-TYPES SUPER-TYPES
Sub-Types and Super-Types are used to allow for
INHERITANCE in SQL3
A Sub-Type can inherit from more than one
Super-Type. Multiple Inheritance is allowed!
51
ORDBMSs
SQL3 - SUB-TYPES SUPER-TYPES
CREATE TYPE staff_type UNDER person_type AS
( sno VARCHAR(5) NOT NULL
UNIQUE, position VARCHAR(10) NOT
NULL, salary NUMBER(7,2), bno VARCHAR(3) NOT
NULL, CREATE FUNCTION is_manager (s STAFF_TYPE)
RETURNS BOOLEAN BEGIN IF s.position
Manager THEN RETURN TRUE
ELSE RETURN FALSE END IF END) NOT FINAL
52
ORDBMSs
SQL3 - TYPES TABLES
In order to remain upwardly compatible with
SQL-92, TYPES can ONLY be instantiated through
SQL Tables!
Therefore, in order to create instances of a type
we first have to create a table to store those
instances in!
53
ORDBMSs
SQL3 - SUB-TABLES SUPER-TABLES
PROBLEM - What happens if we create two or more
tables for the same TYPE? How do we find all
TYPE instances?
The only way of doing this is to declare the
lecturer and admin tables as sub-tables of a
staff super-table!
54
ORDBMSs
SQL3 - SUB-TABLES SUPER-TABLES
SUPER-TABLE
SUB-TABLES
SOLUTION TO PROBLEM (FIND ALL STAFF) SQL
SELECT FROM staff
55
ORDBMSs
SQL3 - REFERENCE TYPES AND OIDS
A Reference Type is the SQL3 equivalent of an OID
in an OODBMS. Reference Types allow a row to be
shared among multiple tables, and enable users to
replace complex join operations with path
expressions!
EXAMPLE
56
ORDBMSs
SQL3 - REFERENCE TYPES AND OIDS
To ensure that a REFERENCE is limited to a single
table, a SCOPE has to be added to the table using
the REFERENCE!
57
ORDBMSs
SQL3 - COLLECTION TYPES
SQL3 COLLECTION TYPES ARE THE EQUIVALENT OF
COLLECTION TYPES IN OODBMSs
List (base) - ordered collection allows
duplicates Array (base) - one-dimensional
array, max no. Set (base) - unordered
collection, no duplicates Multiset(base) -
unordered collection, allows duplicates
58
ORDBMSs
SQL3 - COLLECTION TYPES
EXAMPLE
CREATE TABLE branch ( bno NUMBER(3), address ROW
( street VARCHAR(15), area VARCHAR(15), cit
y VARCHAR(15) staff SET (STAFF_TYPE))
59
ORDBMSs
SQL3 - OTHER ADDITIONS
THE MAIN ADDITIONS TO SQL THAT ARE NOT
SPECIFICALLY ASSOCIATED WITH ADDING
OBJECT-SUPPORT ARE THE FOLLOWING
SQL IS NOW COMPUTATIONALLY COMPLETE
PERSISTENT STORED MODULES ARE SUPPORTED
TRIGGERS ARE SUPPORTED
60
OODBMS or ORDBMS
CONSIDERATIONS
OODBMS - put more emphasis on the role of the
client, i.e., Client side caching! This can
radically improve long, process intensive,
transactions.
ORDBMS - SQL is still the language for data
definition, manipulation and query Still have
Impedance Mismatch!
OODBMSs have been optimised to directly support
object-oriented applications and specific OO
languages.
ORDBMSs are supported by most of the major
players in the DBMS market place.
61
OODBMS or ORDBMS
CONSIDERATIONS
ORDBMS - Most third-party database tools are
written for the relational model (SQL-92), and
will therefore be backward-compatible with SQL3.
ORDBMS - search, access and manipulate complex
data types in the database with standard SQL
(SQL3), without breaking the rules of the
relational data model.
OODBMS The ODMG standard groups OQL is now the
de-facto query language amongst OODBMS vendors.
However, in order to use it, collection objects
(known as extents) have to first be created for
each class.
62
OODBMS or ORDBMS
CONSIDERATIONS
OODBMS - In order to realise the value of an
OODBMS you must build your application using
methods written in one of several object-oriented
language (i.e. C, Java, Smalltalk).
63
  • OODBMS or ORDBMS
  • In applications that generally retrieve
    relatively few (generally physically large)
    highly complex objects and work on them for
    fairly long periods of time. This will
    necessitate the use of client caching, pointer
    swizzling, and non-locking forms of concurrency
    control.

WHEN TO USE AN OODBMS
64
  • OODBMS or ORDBMS
  • In applications that process a large number of
    short-lived (generally ad-hoc query) transactions
    on data items that can be arbitrarily complex in
    structure. Where the main emphasises is on
    efficient query optimisation to limit disk
    accesses, and traditional concurrency control is
    acceptable.

WHEN TO USE AN ORDBMS
Write a Comment
User Comments (0)