1

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:

  • class Movie Distributor - statement 3 from above (at most)
  • class Cinema - statements 1 and 2 from above: I interprete these statements as "a movie distributor lends a film to at least 1 cinema
  • class Movie: statement 5 (several movies)

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

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
Martina
  • 139
  • 1
  • 10
  • Your association statements are expressed in a strange way not using clear English. For instance, does "1 movie distributor lends 1 certain movie to several cinemas" mean "A movie distributor lends a movie to one or more cinemas"? You should reformulate your statments in clear/unambiguous English. – Gerd Wagner Oct 18 '21 at 21:50
  • I updated the associations, thanks for your suggestion! – Martina Oct 18 '21 at 22:04
  • Thanks Geert for your advice, I added the diagram – Martina Oct 19 '21 at 09:10
  • Your statement 2 is still not clear. It seems to express that a distributor lends a movie to only one cinema ("not to other cinemas"), which contradicts statement 1. Statements 1, 3 and 5 are expressed in your class diagram, as explained by @Christophe below, and 4 is just a clarification that there is no such constraint, which is implied by your class diagram, as explained by Christophe below. Consequently, your question has been answered by Christophe. – Gerd Wagner Oct 19 '21 at 21:51

1 Answers1

2

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:

  • introduce a fourth object that models the Rental, in addition to the Movie, Distributor and Cinema.
  • use a ternary association between the already identified classes.
  • use an association class to represent pne of the three clasdes. But this does not seem suitable here, as it would not aknowledge that movies, cinemas and disributors exist independently of their relationships.
  • use an association class to tepresent the rental

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:

  • For a given Distributor and a given Cinema, there can be 0..* Movies lent. That's (5).
  • For a given Cinema and a given Movie, there can be 0..1 Distributor making the lend. That's (3)
  • For a given Movie and a given Distributor, the lend can be for 1..* Cinema. That's (1) and (2). (This also means that it make no sense to lend no movie)

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

  • Nothing says that a given Movie can have only one Distributor. So we are allowed to imagine cases with several distributors for the same movie, isn't it ?
  • Nothing says that a given Movie is shown only in one Cinema. So we are allowed to imagine the same movie in several cinemas.
  • Taking both together, we have a movie with several distributors and several cinemas.
  • Now nothing requires that there should be only one Movie for a pair of Cinema/Distributor (otherwise the multiplicity of Movie would be 0..1 and not 0..*
  • By deduction, a movie can be combined with several cinemas and distributors, with different distributors involved.
Christophe
  • 68,716
  • 7
  • 72
  • 138
  • Thanks Christophe for your suggestions! I already tried to model the diagram with an object rental, but I get stuck at the same points that I described with the ternary associations. I added the diagram to my question, so that you see where I'm at. – Martina Oct 19 '21 at 09:12
  • Thanks Christophe for your detailed answer!! That was very helpful, thank you so much – Martina Oct 20 '21 at 03:01
  • Is it ok to write something like "Rental" into the Rhombus? And/or is it necessary to name every association in the diagram? Or would my diagram above be enough to describe this bunch of connections? – Martina Oct 20 '21 at 04:53
  • @Martina Normally you wouldn't write "Rental" in the diamond. Morover, very often the name is to large to nicely fit into the symbol. The usual way is to write it above the symbol. The [UML specs](https://www.omg.org/spec/UML/2.5.1/About-UML/) write page 201: "The Association’s name can be shown as a name string near the Association symbol, but not near enough to an end to be confused with the end’s name". An example is provided page 208 figure 11.36. – Christophe Oct 20 '21 at 19:46