Download Chapter 11

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
11
Chapter 11
Object-Oriented Databases
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
11
In this chapter, you will learn:
• What basic concepts govern OO systems
• What effect OO concepts are likely to have on
data modeling and design
• How OO features are related to the more
traditional relational and E-R models
• What the basic features of an OO database
management system (OODBMS) are
• About the advantages and disadvantages of
OODBMSs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
2
11
Object Orientation
• Object Orientation
– Set of design and development principles
– Based on autonomous computer structures
known as objects
• OO Contribution areas
–
–
–
–
–
Programming Languages
Graphical User Interfaces
Databases
Design
Operating Systems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
3
11
Evolution of OO Concepts
• Concepts stem from object-oriented
programming languages (OOPLs)
– Ada, ALGOL, LISP, SIMULA
• OOPLs goals
–
–
–
–
Easy-to-use development environment
Powerful modeling tools for development
Decrease in development time
Make reusable code
• OO Attributes
– Data set not passive
– Data and procedures bound together
– Objects can act on self
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4
11
OO Concepts: Objects
• Abstract representation of a real-world entity
– Unique identity
– Embedded properties
– Ability to interact with other objects and self
• OID
– Unique to object
– Not a primary key
• Attributes
– Called instance variables
– Domain
• Object state
– Object values at any given time
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
5
11
OO Concepts: Objects (con’t.)
• Methods
– Code that performs operation on object’s data
– Has name and body
• Messages
– Invokes method
– Sent to object
• Classes
– Collection of similar objects
– Shares attributes and structure
• Protocol
– Represents object’s public aspect
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6
11
OO Concepts: Objects (con’t.)
• Class hierarchy
– Code that performs operation on object’s data
– Has name and body
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7
11
Object Characteristics
Figure 11.7
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8
11
Class Hierarchy
• Superclass
• Subclass
• Class lattice
Figure 11.8
Database Systems: Design, Implementation, & Management,
5th
Edition, Rob & Coronel
9
11
Inheritance
• Ability of object to inherit the data structure and
behavior of classes above it
• Single inheritance
– Class has one immediate superclass
Figure 11.9
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10
11
Inheritance (con’t.)
• Multiple
– Class has more than one immediate superclass
Figure 11.10
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11
11
Method Overriding
• Method redefined at subclass level
Figure 11.12
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12
11
Polymorphism
Allows different objects to respond to same
message in different ways
Figure 11.13
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13
11
Abstract Data Types (ADT)
• Describes a set of similar objects
• Differs from conventional data types
– Operations are user-defined
– Uses encapsulation
• Definitions needed for creation
– Name
– Data representation
– Abstract data type operations and constraints
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
14
11
Object Classification
• Simple
– Only single-valued attributes
– No attributes refer to other object
• Composite
– At least one multivalued attribute
– No attributes refer to other object
• Compound
– At least one attribute that references other
object
• Hybrid
– Repeating group of attributes
– At least one refers to other object
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
15
11
Characteristics of OODM
•
•
•
•
•
Supports complex objects
Must be extensible
Supports encapsulation
Exhibit inheritance
Supports object identity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16
11
OO vs. E-R Model Components
Table 11.3
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
17
11
Shared Representation
for all Objects of the Class Person
Figure 11.14
Figure 11.15
Database Systems: Design, Implementation, & Management,
5th
Edition, Rob & Coronel
18
11
Referential Sharing of Objects
Figure 11.19
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
19
11
Class-Subclass Relationship
Figure 11.21
Figure 11.20
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
20
11
Interobject Relationships
• Attribute-Class Link
• Object’s attribute references another object
• Relationship Representation
– Related classes enclosed in boxes
– Double line on right side indicates mandatory
– Connectivity indicated by labeling each box
• 1:M
• M:N
• M:N with an Intersection Class
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
21
11
1:1 and 1:M Relationships
Figure 11.24
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
22
11
Employee-Dependent Relationship
Figure 11.25
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
23
11
Representing the M:N Relationship
Figure 11.26
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
24
11
Representing the M:N Relationship
with Associated Attributes
Figure 11.27
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
25
11
Representing the M:N Relationship
with Intersection Class
Figure 11.28
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
26
11
Object Space Representation
Figure 11.29
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
27
11
Late and Early Binding
• Late binding
– Data type of attribute not known until runtime
– Allows different instances of same class to contain
different data types for same attribute
• Early binding
– Allows database to check data type at compilation
or definition time
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
28
11
OODM vs. E-R Data Models
• Object, Entity, and Tuple
– OODM object has behavior, inheritance, and
encapsulation
– OO modeling more natural
• Class, Entity Set, and Table
– Class allows description of data and behavior
– Class allows abstract data types
• Encapsulation and Inheritance
– Object inherits properties of superclasses
– Encapsulation hides data representation and
method
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
29
11
OODM vs. E-R Data Models (con’t.)
• Object ID
– Not supported in
relational models
• Relationships
– OODM
• Interclass
references
• Class hierarchy
inheritance
• Access
– Relational models
• SQL
– OODM
• Navigational
• Set-oriented access
– Relational models
• Value-based
approach
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
30
11
OODBMS
• Database management system integrates
benefits of typical database systems with OODM
characteristics
• Handles a mix of data types
• Follows OO rules
• Follows DBMS rules
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
31
11
OO and Database Design
• Provides data identification and the procedures
for data manipulation
• Data and procedures self-contained entity
• Iterative and incremental
• DBA does more programming
• Lack of standards
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
32
11
OODBMS Advantages
•
•
•
•
•
•
•
•
More semantic information
Support for complex objects
Extensibility of data types
May improve performance with efficient
caching
Versioning
Reusability
Inheritance speeds development and
application
Potential to integrate DBMSs into single
environment
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
33
11
OODBMS Disadvantages
• Strong opposition from the established
RDBMSs
• Lack of theoretical foundation
• Throwback to old pointer systems
• Lack of standard ad hoc query language
• Lack of business data design and management
tools
• Steep learning curve
• Low market presence
• Lack of compatibility between different
OODBMSs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
34
11
OO Influences on Relational Model
• Extensibility of new user-defined (abstract) data
types
• Complex objects
• Inheritance
• Procedure calls (rules or triggers)
• System-generated identifiers (OID surrogates)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
35
11
The Next Generation of DBMS
•
•
•
•
•
Object-oriented database systems
Artificial intelligence systems
Expert systems
Distributed database
The Internet
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
36
Related documents