Search code examples
umlentity-relationshipclass-diagram

Translate ER to UML


How do you translate this ER relation to UML: enter image description here

This is my attempt: enter image description here

Is this the correct way of doing it? I feel a bit lost.


Solution

  • In an ERD diagram with Chen’s notation:

    • the rectangles are entities, which in UML would be translated into classes;
    • the diamonds are relations between entities, which in UML would translate to associations;
    • (the elipses are attributed, which in UML would be represented either as properties or as association with another class);
    • the cardinalities would translate to multiplicities that you would show on the end of an association.

    So in UML you’d have a book, and a reflexive association line labeled “sequel” and with a 1 near both ends. Much simpler that what you showed.

    For more explanations about the mapping and the subtle differences, as well as transforming the one into the other, you may have a look at this other SO answer.

    Finally, I am not sure that your 1:1 relation in Chen’s ERD notation is completely equivalent to your tabular notation: the association table that you use corresponds to a many to many association (since the same book can appear in several “records”). Additional code would be needed to retrict its use to 1:1. But btw I’m not sure that the sequel association would be a one to one either (i.e one book has only one other book as sequel and vice versa).