Title: Object-Oriented Database Development (Hoffer Chap 15)
1Object-Oriented Database Development (Hoffer Chap
15)
- University of California, Berkeley
- School of Information Management and Systems
- SIMS 257 Database Management
2Lecture Outline
- Review
- Object Oriented DBMS
- Inverted File and Flat File DBMS
- Object-Relational DBMS (revisited)
- Intelligent DBMS
- Object Oriented Database Development
- Design using UML
- Construction with ODL
- Querying with OQL
3Lecture Outline
- Review
- Object Oriented DBMS
- Inverted File and Flat File DBMS
- Object-Relational DBMS (revisited)
- Intelligent DBMS
- Object Oriented Database Development
- Design using UML
- Construction with ODL
- Querying with OQL
4Object-Oriented DBMS Basic Concepts
- Each real-world entity is modeled by an object.
Each object is associated with a unique
identifier (sometimes call the object ID or OID)
5Object-Oriented DBMS Basic Concepts
- Each object has a set of instance attributes (or
instance variables) and methods. - The value of an attribute can be an object or set
of objects. Thus complex object can be
constructed from aggregations of other objects. - The set of attributes of the object and the set
of methods represent the object structure and
behavior, respectively
6Object-Oriented DBMS Basic Concepts
- The attribute values of an object represent the
objects status. - Status is accessed or modified by sending
messages to the object to invoke the
corresponding methods
7Object-Oriented DBMS Basic Concepts
- Objects sharing the same structure and behavior
are grouped into classes. - A class represents a template for a set of
similar objects. - Each object is an instance of some class.
8Object-Oriented DBMS Basic Concepts
- A class can be defined as a specialization of of
one or more classes. - A class defined as a specialization is called a
subclass and inherits attributes and methods from
its superclass(es).
9Object-Oriented DBMS Basic Concepts
- An OODBMS is a DBMS that directly supports a
model based on the object-oriented paradigm. - Like any DBMS it must provide persistent storage
for objects and their descriptions (schema). - The system must also provide a language for
schema definition and and for manipulation of
objects and their schema - It will usually include a query language,
indexing capabilities, etc.
10Generalization Hierarchy
11Inverted File DBMS
- Usually similar to Hierarchic DBMS in record
structure - Support for repeating groups of fields and
multiple value fields - All access is via inverted file indexes to DBS
specified fields. - Examples ADABAS DBMS from Software AG -- used in
the MELVYL system
12Flat File DBMS
- Data is stored as a simple file of records.
- Records usually have a simple structure
- May support indexing of fields in the records.
- May also support scanning of the data
- No mechanisms for relating data between files.
- Usually easy to use and simple to set up
13Object Relational Data Model
- Class, instance, attribute, method, and integrity
constraints - OID per instance
- Encapsulation
- Multiple inheritance hierarchy of classes
- Class references via OID object references
- Set-Valued attributes
- Abstract Data Types
14PostgreSQL Classes
- The fundamental notion in Postgres is that of a
class, which is a named collection of object
instances. Each instance has the same collection
of named attributes, and each attribute is of a
specific type. Furthermore, each instance has a
permanent object identifier (OID) that is unique
throughout the installation. Because SQL syntax
refers to tables, we will use the terms table and
class interchangeably. Likewise, an SQL row is an
instance and SQL columns are attributes.
15Creating a Class
- You can create a new class by specifying the
class name, along with all attribute names and
their types - CREATE TABLE weather (
- city varchar(80),
- temp_lo int, -- low
temperature - temp_hi int, -- high
temperature - prcp real, --
precipitation - date date
- )
16Intelligent Database Systems
- Intelligent DBS are intended to handle more than
just data, and may be used in tasks involving
large amounts of information where analysis and
discovery are needed.
The following is based on Intelligent Databases
by Kamran Parsaye, Mark Chignell, Setrag
Khoshafian and Harry Wong AI Expert, March 1990,
v. 5 no. 3. Pp 38-47
17Intelligent Database Systems
- They represent the evolution and merging of
several technologies - Automatic Information Discovery
- Hypermedia
- Object Orientation
- Expert Systems
- Conventional DBMS
18Intelligent Database Systems
Automatic discovery
Expert Systems
Intelligent Databases
Hypermedia
Object Orientation
Traditional Databases
19Intelligent Databases
- Intelligent Database Engine
- OO support
- Inference features
- Global optimization
- Rule manager
- Explanation manager
- Transaction manager
- Metadata manager
- Access module
- Multimedia manager
20Lecture Outline
- Review
- Object Oriented DBMS
- Inverted File and Flat File DBMS
- Object-Relational DBMS (revisited)
- Intelligent DBMS
- Object Oriented Database Development
- Construction with ODL
- Design using UML
- Querying with OQL
21Chapter 15Object-Oriented Database Development
- Modern Database Management
- 6th Edition
- Jeffrey A. Hoffer, Mary B. Prescott, Fred R.
McFadden
This Lecture uses the slides following from
www.prenhall.com/hoffer
22Object Definition Language (ODL)
- Corresponds to SQLs DDL (Data Definition
Language) - Specify the logical schema for an object-oriented
database - Based on the specifications of Object Database
Management Group (ODMG)
23Defining a Class
- class keyword for defining classes
- attribute keyword for attributes
- operations return type, name, parameters in
parentheses - relationship keyword for establishing
relationship
24Defining an Attribute
- Value can be either
- Object identifier OR Literal
- Types of literals
- Atomic a constant that cannot be decomposed
into components - Collection multiple literals or object types
- Structure a fixed number of named elements,
each of which could be a literal or object type - Attribute ranges
- Allowable values for an attribute
- enum for enumerating the allowable values
25Kinds of Collections
- Set unordered collection without duplicates
- Bag unordered collection that may contain
duplicates - List ordered collection, all the same type
- Array dynamically sized ordered collection,
locatable by position - Dictionary unordered sequence of key-value
pairs without duplicates
26Defining Structures
- Structure user-defined type with components
- struct keyword
- Example
- struct Address
- String street_address
- String city
- String state
- String zip
27Defining Operations
- Return type
- Name
- Parentheses following the name
- Arguments within the parentheses
28Defining Relationships
- Only unary and binary relationships allowed
- Relationships are bi-directional
- implemented through use of inverse keyword
- ODL relationships are specified
- relationship indicates that class is on many-side
- relationship set indicates that class is on
one-side and other class (many) instances
unordered - relationship list indicates that class is on
one-side and other class (many) instances ordered
29Figure 15-1 UML class diagram for a university
database
The following slides illustrate the ODL
implementation of this UML diagram
30Figure 15-2 ODL Schema for university database
31Figure 15-2 ODL Schema for university database
class keyword begins the class definition.Class
components enclosed between and
32Figure 15-2 ODL Schema for university database
specify allowable values using enum
33Figure 15-2 ODL Schema for university database
extent the set of all instances of the class
34Figure 15-2 ODL Schema for university database
Operation definition return type, name, and
argument list. Arguments include data types and
names
35Figure 15-2 ODL Schema for university database
36Figure 15-2 ODL Schema for university database
37Figure 15-2 ODL Schema for university database
38Figure 15-3 UML class diagram for an employee
project database
(a) Many-to-many relationship with an association
class
Note In order to capture special features of
assignment, this should be converted into two 1N
relationships
39Figure 15-3 UML class diagram for an employee
project database
(b) Many-to many relationship broken into two
one-to-many relationships
class Employee (extent employees key
emp_id) . attribute set (string)
skills_required
Note key indicates indentifier (candidate key)
Note attribute set indicates a multivalued
attribute
40Figure 15-4 UML class diagram showing employee
generalization
class Employee extends Employee (
. .
Note extends denotes subclassing
41Figure 15-5 UML class diagram showing student
generalization
42Creating Object Instances
- Specify a tag that will be the object identifier
- MBA699 course ()
- Initializing attributes
- Cheryl student (name Cheryl Davis,
dateOfBirth4/5/77) - Initializing multivalued attributes
- Dan employee (emp_id 3678, name Dan Bellon,
skills Database design, OO
Modeling) - Establishing links for relationship
- Cheryl student (takes OOAD99F, Telecom99F,
Java99F)
43Querying Objects in the OODB
- Object Query Language (OQL)
- ODMG standard language
- Similar to SQL-92
- Some differences
- Joins use classs relationship name
- Select x.enrollment from courseofferings x,
x.belongs_to y where y.crse_course MBA 664
and x.section 1 - Using a set in a query
- Select emp_id, name from employees where
Database Design in skills
44Current ODBMS Products
- Rising popularity due to
- CAD/CAM applications
- Geographic information systems
- Multimedia
- Web-based applications
- Increasingly complex data types
- Applications of ODBMS
- Bill-of-material
- Telecommunications navigation
- Health care
- Engineering design
- Finance and trading
45Table15-1 ODBMS Products