Вы находитесь на странице: 1из 24

Object Orientated Database Management Systems

Team Nutmeg V2 Bock Yang

What is RDBMS?

Relational Database Management System(RDBMS) RDBMS requires tabular structure for data RDBMS is designed to take care of large amounts of data and secure it unlike DBMS

Reasons for Unsuitability of RDBMS

Poor Representation of "Real World" Entities


Normalization leads to relations that does not correspond to entities in real world.

Semantic Overloading
Relational model has only one construct for representing data and data relationships: the relation

Reasons for Unsuitability of RDBMS

Poor support for Integrity and Enterprise Constraints Homogeneous Data Structure
Relational model assumes both horizontal and vertical homogeneity

RDBMS has limited operations which only have a fixed set of operations that cannot be extended

Reasons for Unsuitability of RDBMS

Difficulty handling of Recursive Queries


Recursive queries are queries about relationships that a relation has with itself (directly or indirectly)

Extension proposed to relational algebra to handle this type of query is recursive closure operation (i.e. tuples are transitively deduced)

Recursive Example

SELECT managerstaffNo FROM Staff WHERE staffNo=S005 UNION SELECT managerstaffNo FROM Staff WHERE staffNo= (SELECT managerstaffNo FROM Staff WHERE staffNo=S005)

Reasons for Unsuitability of RDBMS

Other Problems with RDBMS


Transactions are generally short-lived and concurrency control protocols not suited for long-lived transactions
Schema changes are difficult

RDBMS are poor at navigational access

OO Concepts
Abstraction, encapsulation, information hiding. Objects and attributes. Object identity. Methods and messages. Classes, subclasses, superclasses, and inheritance. Overloading. Polymorphism and dynamic binding.

Abstraction

Denotes extracting of essential details about items or a group of items while ignoring the inessential details.

Focus on attributes of an object before deciding on the implementation methods.

Encapsulation and Information Hiding


*Note: Encapsulation is not information hiding Encapsulation: TO enclose related operations and data related to an object into that object Information Hiding: Hiding certain details which will not affect other parts of the system.

Object

Superkey identifiable entity that have both attributes and actions associated with it.

Attributes
Contains current state of an object Classified into simple or complex Simple attributes can be primitive type such as integer, string, etc. Complex attributes contain collections or references

Object Identity
Object Identifier must be System-generated Unique Invariant Independent of the values of its attributes Invisible to user

Mapping object into RDBMS


Requires mapping class instances to one or more tuples with distributed relations Have to handle 2 basic class hierarchy tasks

1. Design relations to represent hierarchy 2. Design how objects will be accessed

Object Identity Implementation


In RDBMS, object identity is valuebased: primary key is used to provide uniqueness. Primary keys do not provide type of object identity required in OO systems:

key only unique within a relation, not across entire system Key generally chosen from attributes of relation, making It dependent on object state

Methods and Messages

Method
Defines behaviour of an object, as set of encapsulated functions

Message
Request from one object to another asking secondary object to execute one of its methods.

Object Showing Attributes and Methods

Example of a Method

Class
Blueprint for defining a set of similar objects. Objects in a class are called instances. Class is also an object with own class attributes and class methods. Class different from type

Class Instance Share Attributes and Methods

Mapping Classes to Relations

Example

Mapping Classes to Relations

(1) Map each class or subclass to a relation:

Lecturer(StaffID, homeNO, ExtensionNO, position, gender) Course Manager(StaffID, course, lecturers) Course Coordinator(StaffID, students) Subject Manager(StaffID, Subject, labs)

Mapping Classes to Relations

(2) Map each subclass to a relation

Course Manager(StaffID, homeNO, ExtensionNO, position, gender, course, lecturers) Course Coordinator(StaffID, homeNO, ExtensionNO, position, gender ,students) Subject Manager(StaffID, homeNO, ExtensionNO, position, gender, Subject, labs)

Mapping Classes to Relations

(3) Map the hierarchy to a single relation

Lecturer(StaffID, homeNO, ExtensionNO, position, gender ,course, lecturers ,students , subject, labs)