Adam Siemion
Adam Siemion

Reputation: 16039

Can association lines be merged in one line in UML?

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

Upvotes: 4

Views: 768

Answers (3)

Vladimir
Vladimir

Reputation: 2129

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.

Upvotes: 1

observer
observer

Reputation: 3005

(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.

Upvotes: 3

Gerd Wagner
Gerd Wagner

Reputation: 5673

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.

Upvotes: 4

Related Questions