Professional Documents
Culture Documents
C
1
3
/
D
6 III. Current Trends
Object-Relational DBMSs
Content
15.1 Objectives
15.2 Introduction to O-R database systems
15.3 The third-generation database manifestos
– The third-generation database system manifesto
– The third manifesto
15.4 An early example - Postgres
15.5 SQL3 – the way forward for ORDBMS?
– New types: row types, collection types, UDTs
– Reference types and object identity
– Subtypes and supertypes
– User defined routines, polymorphism
– Persistent stored modules
– Triggers
15.6 Comparing OODBMS and ORDBMS
15.7 Summary
III. Current Trends: 3 - Object-Relational DBMSs Slide 2/24
15.1 Objectives
Objectives
In this Lecture you will learn:
• How the relational model has been
extended to support advanced database
applications.
• Features proposed in third-generation
database system manifestos.
• Object-oriented features in SQL3
(SQL:1999)
• Some expect OODBMS market to grow at over 50% per year, but unlikely
to overtake RDBMS
• Vendors of RDBMSs conscious of threat and promise of OODBMS.
• Agree that RDBMSs not currently suited to advanced database apps,
• Reject claim that extended RDBMSs will not provide sufficient
functionality/be too slow to cope adequately with new complexity.
All models:
–share basic relational tables and query language,
–all have some concept of ‘object’,
Some models: can store methods (or procedures or triggers).
Some analysts predict ORDBMS will have 50% larger share of market than
RDBMS.
III. Current Trends: 3 - Object-Relational DBMSs Slide 5/24
15.2 Introduction to O-R database systems
Summary:
ORDBMS versus OODBMS
• OODBMS:
– Abandon SQL (use an OO language
instead)
• ORDBMS:
– Extend SQL (with OO features)
Example:
CREATE TABLE Branch (branchNo CHAR(4),
address ROW(street VARCHAR(25), city VARCHAR(15),
postcode ROW(cityIdentifier VARCHAR(4),
subPart VARCHAR(4))));
INSERT INTO Branch VALUES (‘B005’, ROW (‘22 Deer Rd’, ‘London’,ROW(‘SW1’, ‘4EH’)));
SQL3: UDTs
• UDT = User Defined Type
• Two categories of UDTs:
– Distinct types (simplest)
– Structured types
• May be used in same way as built-in types.
Distinct types:
• allows built-in error-checking to differentiate between same underlying built-in
types (only) that should be used in different ways:
CREATE TYPE OwnerNoType AS VARCHAR(5);
CREATE TYPE StaffNoType AS VARCHAR(5);
- (Would get error if attempt to treat as instance of wrong type)
• Not the same as SQL domains, which constrain the set of storable valid values
SQL3: UDTs
Structured Types
• May have one or more attributes (of any type, including UDTs)
• All aspects of their behaviour are provided through methods, functions and
procedures, defined by the user as part of the type ( like OO Class)
• System-generated (hidden) “get” and “set” functions provide access to attribute
values
• Comparisons of values done only through user-defined functions
• Example:
CREATE TYPE emp_type AS (EMP_ID INTEGER, SALARY REAL)
INSTANTIABLE
INSTANCE METHOD GIVE_RAISE (AMOUNT REAL) RETURNS REAL;
• Can access attribute value using common dot notation: p.fName
SQL3: Polymorphism
Routine (procedure, function) names may be overloaded, provided:
Can group statements into a compound statement (block), with its own local
variables.
SQL3: Triggers
Trigger: An SQL (compound) statement executed automatically by DBMS
as side effect of a modification to named table.
Use of triggers include:
– Validating input data and maintaining complex integrity constraints
that otherwise would be difficult/impossible.
– Providing alerts.
Major advantage - standard
– Maintaining audit information. functions can be stored within
– Supporting replication. database and enforced
consistently.
disadvantages:
Syntax: CREATE TRIGGER TriggerName • Complexity.
BEFORE | AFTER <triggerEvent> ON <TableName> • Hidden
functionality.
[REFERENCING <oldOrNewValuesAliasList>]
• Performance
[FOR EACH {ROW | STATEMENT}]
overhead.
[ WHEN (triggerCondition) ] <triggerBody>
Advantages/disadvantages of O-R
database systems
Advantages: Disadvantages:
• Resolves many known • Complexity.
weaknesses of RDBMS. • Increased costs.
• Reuse and sharing: • Proponents of relational
– Reuse: from ability to approach believe simplicity
extend server to perform and purity of relational model
standard functionality are lost.
centrally. • Some believe RDBMS is
– increased productivity for being extended for what will
developer and end-user. be a minority of applications.
• Preserves significant body of • OO purists not attracted by
knowledge and experience extensions either.
gone into developing • SQL now extremely complex.
relational applications.
Summary
15.1 Objectives
15.2 Introduction to O-R database systems
15.3 The third-generation database manifestos
– The third-generation database system manifesto
– The third manifesto
15.4 An early example - Postgres
15.5 SQL3 – the way forward for ORDBMS?
– New types: row types, collection types, UDTs
– Reference types and object identity
– Subtypes and supertypes
– User defined routines, polymorphism NEXT LECTURE:
– Persistent stored modules IV: Emerging Trends:
Part 1: Web technology and DBMSs
– Triggers
- overview of internet and Web as a
15.6 Comparing OODBMS and ORDBMS database application platform
15.7 Summary - approaches to integrating databases