Search code examples
classassociationsumlternary

UML - Association between 3 classes


I have a piece of statement that I don't understand how to model it in a class diagram. It is about Formula 1 races. The piece is the following:

We can only have one race per circuit in each season

So there is a relationship between CIRCUIT, SEASON and RACE.


I believe that it is a ternary association, but a mate told me that it could be an association between CIRCUIT - SEASON and then an association between that association and RACE:

Association of an association diagram

Is that picture wrong? I mean, association should be between 2 classes as far as I know. Not between a class and an association...

Thank's you very much!!!!

EDIT: The statement was wrong, I restated it and could be translated in: (imagine we have 3 circuits)

  • Circuit A in Season 1 --> Race 1
  • Circuit B in Season 1 --> Race 2
  • Circuit C in Season 1 --> Race 3
  • Circuit A in Season 1 --> Race 4 (This should not be allowed, we can only have one race per circuit in each season)
  • Circuit A in Season 2 --> Race 5 (This is correct)

We can only have 1 race per circuit in each season


Solution

  • To make Race an association class as desired, make the horizontal connector dashed and remove the multiplicities. The above currently shows sort of a ternary connector (see discussion).

    enter image description here

    This is equivalent to

    enter image description here

    The multiplicity 0..1 tells that there is one or no race per season and circuit.