ER-to-Relational Mapping Algorithm (contd.) ◼ Step 7: Mapping of N-ary Relationship Types. ◼ N+1 relations approach: similar to 3-relations approach ◼ For each n-ary relationship type, create a new relation ◼ Include as FK attributes the PKs of the relations that represent the participating entity types.
Mapping EER Model Constructs to Relations ◼ Step8: Options for Mapping Specialization or Generalization ◼ m specialization subclasses {S1, S2,….,Sm} and the generalized superclass C ◼ Option 8A: Multiple relations-Superclass and
subclasses ◼ Option 8B: Multiple relations-Subclass relations only
◼ Option 8C: Single relation with one type attribute
Mapping EER Model Constructs to Relations ◼ Option 8A: Multiple relations-Superclass and subclasses ◼ Create a relation for each subclass and the superclass ◼ The PK attribute of superclass relation will be present in the subclass relations and will be PK as well as FK
Mapping EER Model Constructs to Relations ◼ Option 8B: Multiple relations-Subclass relations only ◼ No relation for superclass, only for subclasses ◼ Superclass attributes added to subclass relations ◼ Only works for a specialization whose subclasses are total i.e. every entity in the superclass must belong to (at least) one of the subclasses
Mapping EER Model Constructs to Relations (contd.) ◼ Option 8C: Single relation with one type attribute ◼ Only one relation containing attributes of superclass and all subclasses ◼ One type attribute to indicate the subclass type
Mapping EER Model Constructs to Relations (contd.) ◼ Option 8D: Single relation with multiple type attributes ◼ When an entity can belong to multiple subclasses ◼ Only one relation containing attributes of superclass and all subclasses ◼ m Boolean type attributes to indicate entity type