In section 11.8.15.5 "Association Ends" and 11.8.15.6 "Operations" of StructuredClassifier
on p. 275 of the PDF version of the UML 2.5.1 specification, we see the definitions of these two items:
• /role : ConnectableElement [0..*]{union, subsets Namespace::member} (opposite
A_role_structuredClassifier::structuredClassifier)
The roles that instances may play in this StructuredClassifier.
and
• allRoles() : ConnectableElement [0..*]
All features of type ConnectableElement, equivalent to all direct and inherited roles.
body: allFeatures()->select(oclIsKindOf(ConnectableElement))
->collect(oclAsType(ConnectableElement))->asSet()
What is the intended derivation of /role
? It is derived, but there is no OCL implementation given. The operation allRoles()
returns both owned and inherited roles, but I assume that /role
should not return any Features
of the parents (returned from allFeatures()
). It does subset member
, so it might include some imported Elements
.
Is this correct? Or is the allRoles()
operation supposed to somehow implement the derivation of the /role
attribute?
The derivation of role
is simply given by {union}
.
It is a derived union of all the attributes that subset role
. So, no ocl is necessary. allRoles()
is just for convenience. It is used in other constraints.