UML to Relations
We now describe how a UML Diagram can be mapped to a relational schema:
- Classes to Relations. For each class, create a relation whose name is the name of the class and whose attributes are the attributes of the class.
- Associations to Relations. For each association create a relation with the name of the association. The attributes of this new class are the key attributes of the two connected classes. If there is a name collision, do an appropriate renaming. Then add any attributes, renaming as needed, of any association classes for this association.
- Subclasses to Relations. Here we can use any of the techniques we used for mapping Isa relationships in the E/R setting. Perhaps the simplest is the Using Multiple Relations of the form Superclass and Subclass approach.
- Aggregations and Compositions to Relations. We can use the same technique as the many-one mapping from the E/R diagram setting.