seminar #: 10 (object oriented database design) advanced db technologies (cg096) 1 purpose to...

7
Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram in UML is mapped onto a generic OO representation. How a relational mapping of a UML class diagram can be compared with an object-oriented representation. Scenario A UML class diagram of a Company database is given in Figure 1, which shows a conceptual model of the database. Company database models the data for a company that has several departments, many employees work for departments on different projects. The database also stores data on employee’s dependents. A mapping of the conceptual model into relational model is given in Figure 2 and a sample relational database shown in Figure 3 (at the end of handout). It is assumed that the students understand UML notations and are familiar with relational concepts. Seminar 10: OODB Design (Self-Study)

Upload: silvester-powell

Post on 17-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram

Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1

Purpose To understand how an OODB is structured. How a class diagram in UML is mapped onto a generic OO representation. How a relational mapping of a UML class diagram can be compared with

an object-oriented representation. Scenario

A UML class diagram of a Company database is given in Figure 1, which shows a conceptual model of the database.

Company database models the data for a company that has several departments, many employees work for departments on different projects.

The database also stores data on employee’s dependents. A mapping of the conceptual model into relational model is given in

Figure 2 and a sample relational database shown in Figure 3 (at the end of handout).

It is assumed that the students understand UML notations and are familiar with relational concepts.

Seminar 10: OODB Design (Self-Study)

Page 2: Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram

Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 2

Conceptual model for Company database

Figure 1

Page 3: Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram

Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 3

Company Relational DB Schema

Figure 2

Page 4: Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram

Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 4

Relational Schema Relationships are implemented using foreign keys. See arrows ( )

from foreign keys to the primary keys. Many-to-many relationships are implemented as a linking relation

using primary keys of participating relations (see WORKS_ON relation).

The real-world concept that an instance of one entity is associated with one or many instances of another entity is not present in relational model. For example, the concept that a department has many employees working for it is not present in the model. The only thing that exist is that an employee has an extra attribute (DNO) that holds the primary key value of his/her department.

Multi-valued attributes are implemented as a separate relation (e.g., DEPT_LOCATIONS).

Composite attributes (e.g. Name) is implemented in terms of its components (e.g., Fname, Minit, Lname).

Page 5: Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram

Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 5

Object Oriented Database Design

Fundamental Principles All kinds of relationships are implemented directly using either single

valued or multi-valued attributes in both participating entities (classes).

Multi-valued attributes are implemented as collection valued attributes (e.g., set, bag, list).

Composite attributes are implemented directly (i.e., struct). Primary keys are not required but supported for their usefulness in

query processing. Value-based foreign keys are not present ODBs. The data type of attributes can be primitive (e.g., short, float, string,

etc) as well as constructed types and collections (e.g., Department, Employee, set<Dependent>, etc).

Page 6: Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram

Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 6

Tasks for the Seminar It is assumed that you understand what the UML

notations stand for and how they are mapped onto relational model. The UML conceptual model is provided to give you an idea of how the relational model came into existence in the first place.

Represent the relational schema in Object Oriented representation. The most important thing to do is thing about the basic concepts of OO databases and try to represent relationships more directly in terms of types, classes, and entities rather than primary or foreign keys.

Page 7: Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 1 Purpose To understand how an OODB is structured. How a class diagram

Seminar #: 10 (Object Oriented Database Design) Advanced DB Technologies (CG096) 7

Sample Company Database (relational)

Figure 3