Title: Advanced Database Systems
1Object-Oriented Databases
2Weaknesses of Relational DBMSs
- Poor representation of 'real world' entities
- Poor support for integrity and business rules
- Homogenous data structure
- Limited operations
- Difficulty handling recursive queries
- Impedance mismatch
3Object-Oriented Concepts
- Abstraction
- Encapsulation
- Information hiding
- Object
- Contains both attributes and associated functions
(methods) - Object Identity (OID)
- Methods and Messages
- Class
- Subclass, Superclass
4. . . Object-Oriented Concepts
- Inheritance
- Single, Multiple, Selective
- Overriding
- Overloading
- Polymorphism
- Operation Polymorphism (Overloading)
- Inclusion Polymorphism
- Parametric Polymorphism
- Dynamic (late) Binding
- Complex Objects
5Object-Oriented Databases
- Relational data model is quite successful in
modeling traditional business database
applications - New emerging complex applications such as
CAD/CAM, scientific databases, GIS, and
multimedia databases have new requirements - Object-oriented database were proposed to meet
the needs of these more complex applications - Object-oriented (OO) technology has its origin in
OO in programming languages (SIMULA, SMALLTALK,
C, Java) - OO languages create transient objects, where OO
databases create persistent and sharable objects
7-1
6OODBMS Overview
- Every object is identified by an object
identifier ( OID ) - Attributes of objects can themselves be objects.
This allows for complex nesting of objects. - OODBMS allow behaviors that operate on data,
which is similar to the Object-oriented languages.
7OODBMS Overview
- OODMS have inheritance which permits new types
that inherit structure from parent types. - OODMS support operator overloading where a single
operator can have multiple implementations
depending on the type of data that it operates on.
8Object Identity
- OODMS generate unique immutable OID value for
each object, which is invisible to the user. - When nesting objects, the OID is used as a
pointer to reference children objects.
9Type Constructors
- Type constructors allow the construction of a
complex object by specifying a triple - i unique object id
- c type constructor
- v value
10Type Constructors
11Example
define type Department tuple ( dname string
dnumber integer mgr tuple
(manager Employee
startdate Date ) locations
set(string) employees set(Employee)
projects set(Project) )
12Operations on Data
- Objects have two components
- State structure of data
- Behavior determined by methods
- External users of objects only know about the
interface, not implementation. - Allows for information hiding and data
encapsulation.
13Example
define class Department type tuple ( dname
string dnumber integer
mgr tuple (manager Employee
startdate Date )
locations set(string)
employees set(Employee)
projects set(Project) ) operations (
no_of_emps integer create_dept
Department desroy_dept boolean
assign_emp(e Employee) boolean
remove_emp(e Employee) boolean
) end Department
14Object Definition Language
- A user can specify object database schema
class Faculty extends Person ( extent faculty )
attribute string rank attribute float
salary attribute string office attribute
string phone relationship Department
works_in inverse Departmenthas_faculty
relationship set ltGradStudentgt advises
inverse Gradstudentadvisor
relationship set ltGradStudentgt on_committee_of
inverse
Gradstudentcommittee void give_raise ( in
float raise ) void promote( in string new_rank
)
15Object Query Language
- select struct (name struct (last_name
s.name.lname, - first_name
s.name.fname), - degrees(select struct (deg
d.degree, - yr d.year,
- college
d.college) - from d in s.degrees)
- from s in csdepartment.chair.advises
16Encapsulation
- Interface (signature) define operations
- Implementation (method)
- A method is invoked by sending a message
- Dot notation
- We can divide the structure of an object into
visible and hidden attributes - Class an object type definition
- Persistent object by naming and reachability
17Example
18Type Hierarchies
- OO databases permit the definition of new types
(extensible type systems) - Type name functions (attributes and
operations) - PERSON Name, Address, Birthdate, Age
- Subtype inherits all the functions of the
supertype - EMPLOYEE subtype-of PERSON Salary, Hiredate
- STUDENT subtype-of PERSON Major, GPA
- Renaming of inherited functions
- Type hierarchy
19Class Hierarchies
- A class is a collection of objects that are
meaningful to some applications - Subclass and superclass
- Predefined system class
- An object value may be a class (a collection of
other objects) - It is possible to create a default class for each
type to hold persistent objects of that type - Persistent class and transient class
20Complex Objects
- Unstructured
- permits storage and retrieval of large objects,
such as images, long text strings, video, images - Also known as binary large objects (BLOBs)
- Structured
- structure of object is known to database
- defined by type constructors such as set, tuple,
bag, array, list
21Complex Objects
- Unstructured complex object
- Binary large objects (BOLBs)
- For example 2D bitmap images
- RDBMS
- OODBMS
- A new type that define structure and operations
- Structured complex objects
- Department
- Ownership semantics encapsulated objects
- Reference semantics referenced objects
22Other Concepts
- Polymorphism operator overloading
-
- Multiple inheritance
- Type lattice
- Selective inheritance
- Versions
23Object-Relational DBMSs
- Tables with methods
- Nested tables
- Object views
- Determine the query the view will represent
- Determine the datatypes the query will return
- Create a type that has the same structure as the
query - Crete the view based on the type
- Large objects
- BLOB (binary large objects)
- CLOB (character large object)
- BFILE (binary files stored outside the database)
24Object-Relational Features of Oracle 8
- Multivalued Attributes Using VARRAY
- CREATE TYPE phone_num_type AS OBJECT(phone_number
CHAR(10)) - CREATE TYPE phone_list_type AS VARRAY(5) OF
phone_num_type - Nested Tables to Represent Complex Objects
- Object Views
25Object-Relational Support in SQL3
- Objects in SQL3
- Tuple type
- CREATE ROW TYPE emp_row_type ( )
- CREATE ROW TYPE comp_row_type ( )
- CREATE ROW TYPE employment_row_type ( employee
REF (emp_row_type), company REF
(comp_row_type)) - CREATE TABLE employment OF TYPE
employment_row_type - Abstract Data Types (ADT)
- CREAT TYPE type_name ( list of component
attributes with individual types declaration of
functions (methods)) - Inheritance
- CREATE TABLE graduate_student UNDER student
26The Nested Relational Data Model
- Non-1NF
- dept (dno, manager, employees, projects,
locations)employees (ename, dependents)project
s (pname, ploc)locations (dloc)dependents
(dname, age) - SQL3 nest and unnest functions
27Conclusion
- Object-oriented databases allows for data
abstraction, information hiding, and inheritance.
- Allows storage of both structured and
unstructured complex objects. - OODMS provide a useful alternative to relational
databases when dealing with data such as bitmap
images, audio, or video.