1 / 8

Seminar 10a : OODB Design

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.

masao
Télécharger la présentation

Seminar 10a : OODB Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 employee’s 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. Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

  2. Conceptual model for Company database Figure 1 Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

  3. Company Relational DB Schema Figure 2 Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

  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). Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

  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). Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

  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; Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

  7. Using Lambda-DB • Open a DOS window. • Connect to cgapp1 using your Unix user account and password by writing telnet cgapp2on 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. Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

  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. Seminar #: 10a (Object Oriented Database Design) Advanced Databases (CM036)

More Related