3.1 Extracting a Relational Data Schema from the Class Diagram

 

The rules for extracting a relational data schema from the class diagram of an application are an extension of the rules for mapping Extended Entity Relationship diagrams onto relational data schemes  [6]. A sample of the these rules is the mapping of Generalization/Specialization hierarchies.

A generalization/specialization hierarchy can be of different types depending upon two properties: disjunction/overlapping and partial/total  [6]. Their combination yields the following four types of hierarchies: 1) disjoint/total, 2) disjoint/partial, 3) overlapping/total, 4) overlapping/partial. If a generalization/specialization hierarchy of type 2, 3, or 4 has superclass C with attributes a1, a2, ..., an and m subclasses S1, S2, ..., Sm , then it is mapped by using the following rules:

Create a table TC with columns a1, ..., an, OIDC corresponding to the attributes of class C plus its OID. The latter will be a candidate primary key for the table TC.

For each subclass Si, 0 < i < m+1, create a table Ti with columns attributes of Si, OIDSi . Once again, here the OID will be a candidate primary key for the table Ti.

Create a system table INHERITANCE, if it does not exist. This table will be updated with the insertion of a new record (superclass-name, subclass-name) for each subclass Si, 0 < i < m+1 and will be used for reverse engineering purposes.

As for generalization/specialization hierarchies of type 1, these are mapped by generating relational tables only for the subclasses S1, S2, ..., Sm with columns attributes of Si, OIDSi, a1, ..., an corresponding to the attributes of the subclasses, plus their OIDs, plus the attributes of the superclass.

Next: Refining the Application through the Dynamic Constructs of the Object Model
Up: Mapping Class Diagrams onto Relational Applications
Previous: Mapping Class Diagrams onto Relational Applications