4

Is it in accordance with the UML standard to merge a few association lines into one line, like on the attached diagram?

assocation lines merged into one line

observer
  • 2,925
  • 1
  • 19
  • 38
Adam Siemion
  • 15,569
  • 7
  • 58
  • 92

3 Answers3

4

Yes, I think this is allowed as a notational variant, which implies that all association ends that participate in the merger, have the same properties (e.g. the same multiplicity, navigability, visibility, etc.).

Figure 11.34 in the UML 2.5 spec shows an example of such a merged association end sharing the same source segment of the association line.

Gerd Wagner
  • 5,481
  • 1
  • 22
  • 41
  • Thanks! UML 2.5 spec: http://www.omg.org/spec/UML/2.5/Beta1/PDF, `Figure 11.34 shows the same model using the notational option of sharing the same source segment between multiple compositions. The multiplicity and name adornments on the shared end apply to all of the compositions.`. Indeed, it seems it is allowed. However I personally find it confusing. – Adam Siemion Mar 03 '15 at 07:35
3

(Edited answer.) In the UML specification a "shared target style" is defined in Figure 9.23 - Examples of generalizations between classes, see http://www.omg.org/spec/UML/2.4.1/ on page 52.

Edit: In the spec, however, this refers only to generalizations, which are not a subtype of associations but of relationships (thanks to @xmojmr for the pointer to the UML superstructure).

In addition to the notation mentioned by @gwag, here is the original caption for that figure:

Figure 11.34 shows a (...) model using the notational option of sharing the same source segment between multiple compositions. The multiplicity and name adornments on the shared end apply to all of the compositions. The model values for absent adornments on the merged segment, such as property modifiers or visibility, may differ.

Found on page 214.

observer
  • 2,925
  • 1
  • 19
  • 38
  • 2
    Generalizations are not special kinds of associations! Therefore, your argument does not apply to the question. – Gerd Wagner Mar 02 '15 at 14:23
  • If they are not, what are they classified as, then? – observer Mar 02 '15 at 14:33
  • 2
    @observer in the metamodel (UML 2.5 Beta 2) they are parts of different inheritance paths: `Relationship→DirectedRelationship→Generalization` and `Relationship→Association` – xmojmr Mar 02 '15 at 15:24
  • In the UML, Generalizations and Associations (and Dependencies) are Relationships. – Gerd Wagner Mar 02 '15 at 15:25
1

So called "tree style" is allowed in generalization and composition (aggregation) at the aggregation end.

But you probably see, that it is unclear to understand which classes are associated from your diagram. Is there association between Client -> Address, and Address <-> Contact details, Or Client -> Contact details and Client -> Address ??? Or all of it ?

Shared lines can add ambiguity to your model.

Vladimir
  • 2,066
  • 15
  • 13