Seminar 10a : OODB Design - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Seminar 10a : OODB Design

Description:

Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036) ... Connect to cgapp1 using your Unix user account and password by writing ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 9
Provided by: ALi109
Category:
Tags: 10a | oodb | design | projects | seminar

less

Transcript and Presenter's Notes

Title: Seminar 10a : OODB Design


1
Seminar 10a OODB Design
  • Purpose
  • This seminar is the continuation of seminar 6.
  • How different UML associations are implemented in
    ODL.
  • 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.
  • 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).
  • 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 and also
    where unsigned short may be the ideal choice as
    lambda-DB complaints about unsigned short when
    used as attribute.
  • 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 cgapp1 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.
  • If completed Seminar 6 (last week) then carry on
    with the tasks of this seminar (by editing
    seminar6.odl to add relationships).
  • Otherwise run the script for setting up seminar7a
    files by
  • /home/makhtarali/CM036/setupSem7
  • The solution of Seminar 6 is available online.
  • Go to the folder seminar 7a by cd CM036/seminar7
  • Open the file seminar7.odl and complete the
    schema by
  • pico seminar7.odl. Save by Ctrl x.
  • Once ready, compile the schema by make (note if
    you were not in last week or you did not run
    make build before, then run make build before you
    compile schema by make)
  • If the compiler reports errors open seminar7.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 have either completed
    seminar 6 or you have copied the files of seminar
    10 to start with.
  • Using the implementation of different kinds of
    associations in ODL (described in the Lecture
    10), implement the various associations given in
    Figure 1 using ODL.
Write a Comment
User Comments (0)
About PowerShow.com