I am still trying to understand the /role
Property in the context of StructuredClassifier
. If I understand {union}
correctly, this means that all elements of the set designated by /role
must be elements contained in one of its subsets. Searching the UML reference for the term "subsets role", I find only two subsetting Properties: StructuredClassifier::ownedAttribute
and Collaboration::collaborationRole
which together would form the derived union of /role
.
But why does /role
exist at all in StructuredClassifier
? AFAICT it would be sufficient to have Collaboration::collaborationRole
subset StructuredClassifier::ownedAttribute
directly, since Collaboration
has no specializations with other possible subsetting Properties to consider. Can a Collaboration
have roles, i.e. Properties, which are not also ownedAttributes
? Or is /role
sometimes used outside of the context of Collaboration
?
Yes,collaborationRoles
are not necessarily attributes
of the Collaboration
. Therefore, both sets are subsets of role
, but can and often have different contents.
collaborationRoles
can be attributes
of other Classes
, parameters
of Operations
or Behaviors
, or variables
of Activities
(i.e. ConnectableElements
).
To add elements to collaborationRoles
you probably have to use the specification dialog. At least in Cameo there is no way to do it in the diagram. Any ConnectableElement
you find in the model can be used.
For the notation the specification allows to draw a line [...] from the elliptical Collaboration shape to rectangles denoting Classifiers that are the types of Properties of the Collaboration. However, I'm not aware of any tools that support this. Please note that these lines are not model elements. The Activity variable would be excluded from this notation, since it is not a Property.
What most tools do instead is creating an additional - superfluous - association. Of course, this only works for owned attributes. Since this is the most common case, it is not as limiting as it sounds.
For example, figure 11.51 is supposed to show these non-association lines.
The dashed lines in figure 11.53 are role bindings. As the specification says, they are dependencies from the attribute (e.g. broker) to the CollaborationUse
. I was able to show them in Cameo, albeit it took a bit of tinkering.
PS: Variables
are rarely used and most people have never heard about them.
PPS: There is no notation specified for collaborationRoles
that are not Properties
. And Cameo can not show attributes
not owned by the Collaboration
in a composite structure diagram.