# These classes must all have the same key attribute

• 34

This preview shows page 27 - 34 out of 34 pages.

These classes must all have the same key attribute; otherwise, the shared subclass would be modeled as a category. We can apply any of the options discussed in Step 8 to a shared subclass, subject to the restriction discussed in Step 8 of the mapping algorithm. Below both 8C and 8D are used for the shared class STUDENT_ASSISTANT.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 28 FIGURE 4.7 A specialization lattice with multiple inheritance for a UNIVERSITY database.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 29 FIGURE 7.5 Mapping the EER specialization lattice in Figure 4.6 using multiple options.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 30 Mapping EER Model Constructs to Relations (contd.) Step 9: Mapping of Union Types (Categories). For mapping a category whose defining superclass have different keys, it is customary to specify a new key attribute, called a surrogate key, when creating a relation to correspond to the category. In the example below we can create a relation OWNER to correspond to the OWNER category and include any attributes of the category in this relation. The primary key of the OWNER relation is the surrogate key, which we called OwnerId.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 31 FIGURE 4.8 Two categories (union types): OWNER and REGISTERED_VEHICLE.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 32 FIGURE 7.6 Mapping the EER categories (union types) in Figure 4.7 to relations.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 33 Mapping Exercise Exercise 7.4. FIGURE 7.7 An ER schema for a SHIP_TRACKING database.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 34 Chapter Summary ER-to-Relational Mapping Algorithm Step 1: Mapping of Regular Entity Types Step 2: Mapping of Weak Entity Types Step 3: Mapping of Binary 1:1 Relation Types Step 4: Mapping of Binary 1:N Relationship Types. Step 5: Mapping of Binary M:N Relationship Types. Step 6: Mapping of Multivalued attributes. Step 7: Mapping of N-ary Relationship Types. Mapping EER Model Constructs to Relations Step 8: Options for Mapping Specialization or Generalization. Step 9: Mapping of Union Types (Categories).