1 / 26

OBJECT-ORIENTED DATABASE SYSTEMS

OBJECT-ORIENTED DATABASE SYSTEMS. Mapping Object-Oriented Conceptual Models to the Object-Oriented Data Model Susan D. Urban and Suzanne W. Dietrich Department of Computer Science and Engineering Arizona State University Tempe, AZ 85287-5406. OUTLINE. Classes

martha
Download Presentation

OBJECT-ORIENTED DATABASE SYSTEMS

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. OBJECT-ORIENTED DATABASE SYSTEMS Mapping Object-Oriented Conceptual Models to the Object-Oriented Data Model Susan D. Urban and Suzanne W. Dietrich Department of Computer Science and Engineering Arizona State University Tempe, AZ 85287-5406

  2. OUTLINE • Classes • Relationships and Associations • Class Hierarchies • Shared Subclasses • Categories • Interface Classes

  3. ER MODELAbstract Enterprise

  4. UMLAbstract Enterprise

  5. OBJECT DEFINITION LANGUAGE: ODL Syntax Summary class className extends superclassName ( extent extentName key keyName ) { attribute <attributeType> attributeName; … relationship <relationType> relationName inverse <inverseSpec>; … method_definitions; }

  6. CLASSESSingle-valued Attributes EER UML • Create an ODL class including the simple attributes of the class. • Composite attributes are represented using a structured type. • Declare an extent and specify key attributes of the extent. • Derived attributes are defined using a get method call.

  7. SINGLE-VALUED ATTRIBUTES Example struct CompositeStruct { string attrA1; string attrA2; string attrA3; }; class A ( extent extentOfA key keyOfA) { attribute string keyOfA; attribute string attrOfA; attribute CompositeStruct compositeOfA; … // define method here for derivedAttr }

  8. CLASSESMulti-valued Attributes EER UML // Multi-valued attributes are defined using a collection type. class C ( … ) { … attribute set<String> multiValuedAttr; // Choose appropriate collection type: set, bag, list … }

  9. ASSOCIATIONS WITHOUT ATTRIBUTES Use appropriate inverse relationships between the classes involved in the association. UML EER

  10. ASSOCIATIONS WITHOUT ATTRIBUTES Example class B ( extent extentOfB key keyOfB) { … relationship C bTOc inverse C::cTOb; } class C ( extent extentOfC keyOfC) { … relationship B cTOb inverse B::bTOc; }

  11. ASSOCIATIONS WITH ATTRIBUTES EER UML Create a class to represent the association, known as the association class, with appropriate attributes in the association class and bi-directional inverse relationships with the classes that participate in the association.

  12. ASSOCIATIONS WITH ATTRIBUTES Example class A (…) { … relationship set<AB> aTOab inverse AB::abTOa; } class B ( … ) { … relationship set<AB> bTOab inverse AB::abTOb; } class AB ( extent extentOfAB) { attribute string attrOfAB; relationship A abTOa inverse A::aTOab; relationship B abTOb inverse B::bTOab; }

  13. RECURSIVE ASSOCIATIONS EER UML //Use inverse relationships within the same class. class B ( extent extentOfB key keyOfB) { … relationship B parent inverse B::child; relationship set<B> child B::parent; }

  14. NAVIGATIONUni-directional Associations UML EER //Use an attribute with a class as a type. class B ( extent extentOfB key keyOfB) { … attribute C bc; }

  15. WEAK OR QUALIFIED ASSOCIATION • Create a class for the weak class with a composite key that includes the key of the owner class. • The weak class can also include a relationship to the object of the owner class. EER UML

  16. WEAK OR QUALIFIED ASSOCIATION Example class A ( extent extentOfA key keyOfA) { attribute string keyOfA; relationship set<Weak> linkToWeak inverse Weak::linkToOwner; … } class Weak ( extent extentOfWeak key (partialKey, keyOfA)) { attribute string partialKey; attribute string keyOfA; relationship A linkToOwner inverse A:: linkToWeak; … }

  17. HOLLYWOOD SCHEMA: EER

  18. HOLLYWOOD SCHEMA: UML

  19. CLASS HIERARCHIES The inheritance of state and behavior is supported by the extends clause in ODL. Example class Person ( … ){ …} class MovieProfessional extends Person ( … ) { // Specific properties and methods for MovieProfessional … } class Celebrity extends Person ( … ) { // Specific properties and methods for Celebrity … }

  20. SHARED SUBCLASSES Multiple inheritance of both state and behavior is not directly supported. An interface defines behavior, which can be inherited in addition to the inheritance through the extends clause.

  21. CATEGORIES • Create a class for the category class. • Create uni-directional attributes that point to the classes that define the category class. • For each instance of the category class, only one of the uni-directional attributes will have a value (to indicate the type of the category object). The other uni-directional attribute(s) will always be null.

  22. CATEGORIES Example: EER

  23. CATEGORIESExample: UML In UML, the category mapping also applies to the use of XOR Constraints (similar to partial or total EER category )

  24. CATEGORIES Example: Sponsor Mapping class Person ( extent Persons key …) { … } class Company ( extent Companies key …) { … } class Sponsor ( extent Sponsors) { attribute Person personSponsor; //Can also be implemented as bi-directional attribute Company companySponsor; //relationships for total categories. … }

  25. INTERFACE CLASSES • Create an interface in ODL. • Subclasses of the interface are defined to implement the interface class.

  26. INTERFACE CLASSES Example interface Business (…) { … string getTaxPayerId(…); void setTaxPayerId(…); integer calcTotalIncome(…);} class Person ( … ) { … } class Company: Business ( … ) { … } class SelfEmployedPerson extends Person: Business ( … ) { … }

More Related