Lecture 27
Object-Oriented Databases
Chapter 18, Database Systems Concepts, by Silberschatz, et al, 1997
Portions reproduced with permission
New Database Applications
The purpose of database systems is the management of large bodies of information. Common features of the "older" systems are:
- Uniformity
. There are a large numbers of similarly structured data items, all of which have the same size in bytes.
- Record orientation
. The basic data items consist of fixed-length records.
- Small data items
. Each record is short -- records are rarely more than a few hundred bytes.
- Atomic fields
. Fields within a record are short and have fixed lengths. There is no structure within fields. In other words, the first normal form holds.
New applications now require new data types:
- Computer-aided design (CAD).
A CAD database stores data pertaining to engineering design, including components of the item being designed, interrelationship of components, and old versions of designs.
- Computer-aided software engineering (CASE).
A CASE database stores data required to assist software developers. These data include source code, dependencies among software modules, definitions and uses of variables, and the development history of the software system.
- Multimedia databases.
A multimedia database contains image, spatial data, audio data, video data, and the like. Databases of this sort arise from the need to store photographs, and geographical data from voice-mail systems, graphics applications, and video-on-demand systems.
- Office information systems (OIS).
Office automation includes workstation-based tools for document creation, retrieval, tools for maintaining appointment calendars, and so on. An OIS database must allow queries pertaining to schedules, documents, and contents of documents.
- Hypertext databases.
Hypertext is text that is enriched with links that point to other documents. The worldwide web is an example of hypertext. Hypertext documents may also be structured in specific ways that help index them. Hypertext database must support the ability to retrieve documents based on links, and query documents based on their structure.
The Object-Oriented Data Model
Object structure
An object roughly corresponds to an entity in the E-R model. An object encapsulates both the data and the code related to an object. All interactions between an object and the rest of the system are via messages. Objects have:
- A set of variables that contain the data for the object (attributes).
- A set of messages, each of which may be a set of parameters.
- A set of methods, each of which is a body of code to implement a message; a method returns a value as the response to the message.
Derived attributes of an entity in the E-R model can be expressed in the O-O model as read-only messages.
Object Classes
Similar objects are grouped into a class (entity-set in the E-R model). An example:
class employee
{
/* Variables */
string name;
string address;
date start-date;
int salary;
/* Messages */
int annual-salary( );
string get-name( );
string get-address( );
int set-address( string new-address );
int employment-length( );
};
Inheritance
To allow the direct representation of similarities among classes, we need to place classes in a specialization hierarchy (the "ISA" relationship).
class person
(
string name;
string address;
};
class employee isa person
{
date start-date;
int salary;
};
Multiple Inheritance
We can use multiple inheritance to model roles.
Object-Oriented Languages
Until now we have covered the basic concepts of O-O at an abstract level. To be used in practice in a database system, the concepts have to be expressed in some language.
- The concepts of O-O can be used purely as a design tool, and are encoded into a relational database, same as converting an ERD into a set of relations.
- Concepts are incorporated into a language that is used to manipulate the database.
- Data-manipulation language is extended by adding complex data types and O-O.
- Change an O-O language to work with a database.
Persistent Programming Languages
Data is persistent when it exists after the program directly manipulating it ceases to exist. Persistent programming language is a language with constructs to handle persistent data. This is different from embedded SQL:
- With an embedded language, the type system of the host language usually differs from the type system of the DML.
- With an embedded language, the programmer is responsible for writing explicit code to fetch data from the database into memory.
Persistence of Objects
- Persistence by class
- Persistence by creation
- Persistence by marking
- Persistence by reference
Storage and Access of Persistent Objects
Finding objects in the database can be by:
- Give objects names.
- Expose object identifiers.
- Store collections of objects and allow programs to iterate over the collection to find required objects.
CSEE | 461 | 461 S'99 | lectures | news | help