0

With entity–relationship diagrams, there are two conventions of denoting multiplicities, (I) and (II):

Say, a teacher T is giving ‹G› some lectures L. Then we can either write this as

        1       M
 (I)  T ———‹G›——— L,

reading

“Every teacher is giving multiple lectures and every lecture is given by exactly one teacher.”,

or as

        M       1
(II)  T ———‹G›——— L,

reading

“Any teacher participates in multiple giving-relations and any lecture participates in exactly one giving-relation”.


The picture becomes more complicated when we introduce ternary relations, say we want to express that a teacher is giving lectures in a certain room R:

       1       ?                  M       1
 (I) T ———‹G›——— L    and  (II) T ———‹G›——— L
           |                          |
           | ?                        | MC
           R                          R

Whereas I can interpret (II) by reading it as

“Any teacher participates in multiple giving-relations, any lecture participates in exactly one giving-relation, and any room participates in none or multiple giving-relations.”

and everything makes perfect sense, I see no way to interpret or express the situation in the case of (I).

For example, we (still) want to say that

“Every lecture is being given by exactly one teacher in exactly one room.”

So this seems to determine the multiplicity ‘1’ at the teacher (as already put in). But then, from the perspective of the room, the relation would read as

“In every room, there are being given (multiple) lectures by exactly one teacher.”

This is already false, as there might be many teachers giving lectures in a certain room.


As I understand is, interpretation (I) is used in UML class diagrams (and of course, sometimes for ER diagrams) – how is this resolved? What should I fill in for the question marks? Am I reading this stuff incorrectly?

  • By the way: I just realized that (II) has its expressive weakness as well, e.g. if we want to remove the restriction that a lecture is to be given in exactly one room, but may be given in different rooms (say on different days of the week). – k.stm May 25 '15 at 19:05
1

I don't think UML prescribes the exact meaning. My impression is that UML limits itself to defining the possible number of things on each end.

For example, spinning up Sparx EA, I create a new basic UML model and a class diagram. I make a class "teacher" and a class "lecture" I then draw an "aggregation" relationship from "lecture" to "teacher" such that the empty diamond is at the "teacher" end.

(This seems to be roughly what you have in mind above)

UML (Sparx) then happily allows me to assign multiplicities of "1-*" at each end. What EXACTLY aggregation means is not clarified by UML. I think this sort of lingering "exercise left to the reader" ambiguity is one reason that UML does not attempt to prescribe the behavior of code generators.

Hope this helps...

  • Thanks, but this still leaves open the question what to do if one is inclined to interpret multiplicities that way. – k.stm May 26 '15 at 16:34
  • Yes, these sorts of ambiguities drive me nuts as well. My solution is stupidly low-tech, but works very well for model-based systems engineering (where the goal is stakeholder clarity NOT code generation) => I simply use the fact that most UML tools let you name the relationship arrow. That is, I name the relationship arrow "participates in" or "is giving" to make the visual impact of the diagram clear. – Dave in Austin May 28 '15 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.