umlassociationsclass-diagram

Can an association of the superclass be transformed into associations for the subclasses?


specialization is totally disjointed. I know that every association a1 involving s1 and c2 must be unique for each year, i.e. there cannot be two instances of s1 associated with c2 with the same year. as regards s2, however, there can be multiple instances of s2 that can be associated with c2 in the same year. Is this representation okay? I have two ideas

  1. can such constraints on the association be developed with triggers or is it necessary to specify with a constraint in an unrestructured class diagram or in documentation?
  2. another alternative was to not directly associate c1 and c2 but create the association as1 with the year attribute and which associates s1 and c2 and the association as2 again with the year attribute which however associates s2 and c2.Would breaking down the main association in this way to personalize it be wrong?

enter image description here


Solution

  • Every link between an instance of c1 (or a subclass of c1) and an instance of c2 is represented by exactly one instance of a1.

    You wrote: "I know that every association a1 involving s1 and c2 must be unique for each year".

    This is only correct if year must be a unique attribute of a1, but there is no reason why you could not have multiple instances of a1 with the same value of attribute year.

    You wrote: "there can be multiple instances of s2 that can be associated with c2 in the same year."

    Your diagram allows this. If you want to indicate that all links between instances of s1 and instances of c2 have a unique value of year, you could add a UML note to the diagram stating just that.