language-lawyerumlocl

UML ConnectorEnd and constraint 'role_and_part_with_port'


This constraint is defined on page 271 of the UML 2.5.1 specification as follows:

11.8.11.6 - Constraints
role_and_part_with_port
---
If a ConnectorEnd references a partWithPort, then the role must be a 
Port that is defined or inherited by the type of the partWithPort.
---
inv: partWithPort->notEmpty() implies
(role.oclIsKindOf(Port) and partWithPort.type.oclAsType(Namespace).member->includes(role))

However, unless I have overlooked something, neither partWithPort nor its type inherits from Namespace. There IS a member feature namespace of Property, which is the type of partWithPort.

Should the constraint be written like this instead?

inv: partWithPort->notEmpty() implies
(role.oclIsKindOf(Port) and partWithPort.namespace.member->includes(role))

Solution

  • partWithPort.type is the type property of the partWithPort. This is a Type which is often a Class which is-a Namespace.