Seminar 6 : OODB Schema in ODL - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Seminar 6 : OODB Schema in ODL

Description:

Seminar 6 : OODB Schema in ODL Purpose To understand how an OODB is structured. How a class diagram in UML is mapped onto an ODL schema. How a relational mapping of a ... – PowerPoint PPT presentation

Number of Views:97
Avg rating:3.0/5.0
Slides: 10
Provided by: ALi109
Category:

less

Transcript and Presenter's Notes

Title: Seminar 6 : OODB Schema in ODL


1
Seminar 6 OODB Schema in ODL
  • Purpose
  • To understand how an OODB is structured.
  • How a class diagram in UML is mapped onto an ODL
    schema.
  • 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 employees
    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.

2
Conceptual model for Company database
Figure 1
3
Company Relational DB Schema
Figure 2
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).

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). This aspect of the design
    will be addressed in next lecture/seminar.
  • 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, setltDependentgt, etc).

6
Using ODL
  • Use short data type for int or integer.
  • Follow these guidelines when using ODL with
    lambda-DB due to some limitations
  • Use short data type for operations that return
    boolean or unsigned short.
  • Use string data type where char applies.
  • Define a composite literal type (using struct)
    and use it where date applies. For example, if
    you are going to define an attribute
  • attribute date birthDate
  • then define date_type as a literal (i.e.,
    struct) first and then write
  • attribute date_type birthDate

7
Using Lambda-DB
  • Open a DOS window.
  • Connect to cgapp2 using your Unix user account
    and password by writing
  • telnet cgapp2 on the Linux prompt.
  • From now on every thing you type is
    case-sensitive.
  • Run the script for setting up seminar6 files by
    /home/makhtarali/CM036/setupSem6
  • Go to the folder seminar6 by cd CM036/seminar6
  • Open the file seminar6.odl and complete the
    schema by
  • pico seminar6.odl. Save by Ctrl x.
  • Once ready, compile the schema by make build and
    make
  • If the compiler reports errors open seminar6.odl
    and go to the specific line by Ctrl w then
    Ctrl t. Save and recompile (by make) until all
    errors are removed.

8
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.
  • Complete implementation of the UML class diagram
    as an OO schema using ODL. A start-up schema
    (seminar6.odl) is available from blackboard and
    on the Linux server. Concentrate on representing
    classes with their attributes and operations.
    Leave associations and association classes for
    the next seminar.
  • Implementation of the UNN_IS1 schema in ODL is
    given for your guidance and is available from
    blackboard.

9
Sample Company Database (relational)
Figure 3
Write a Comment
User Comments (0)
About PowerShow.com