umlassociationsclass-diagramternarymultiplicity

How to model certain associations in UML?


I should portray the following connections between cinemas, movies and movie distributors in an UML class diagram:

  1. A movie distributor lends a certain movie to several cinemas.
  2. A movie distributor lends a certain movie to a certain cinema, but not to other cinemas.
  3. At most one movie distributor lends a movie to a cinema.
  4. But a movie for different cinemas can have different movie distributors.
  5. A movie distributor can lend several movies to the same cinema.

Right now my UML diagram looks like this: UML

I derived the multiplicities from the following statements:

I struggle definitely with statement 4 and I'm not sure about my interpretations of the other statements too.


Solution

  • You may be on the right direction for the multiplicities. However, did you spot the challenge of several classes being involved in the same association?

    To solve this you can:

    Edit

    In view of your diagram, let's first remind the principles of multiplicity in ternary associations, since it's far from being obvious:

    The multiplicity says something about how many times an instance may be present in this associations for any given tuple of linked instances.

    Let's apply it successively. THis will without suprise confirm your own analysis:

    The item 4 is missing, but it's only a consequence of the others. (4) means that we take a given movie: