Search code examples
language-lawyerumlocl

UML Ports and Interfaces


I'm trying to get a grasp on how the member operations Port::basicRequired() and Port::basicProvided() are implemented in the UML 2.5.1 specification. Unfortunately, I have only a rudimentary understanding of OCL and how the context for constraints are implemented.

On page 274 under section 11.8.14.6 "Operations" for the classifier description of Port, we have these OCL versions:

• basicProvided() : Interface [0..*]
The union of the sets of Interfaces realized by the type of the Port 
and its supertypes, or directly the type of the Port if the Port is 
typed by an Interface.
---
body: if type.oclIsKindOf(Interface)
then type.oclAsType(Interface)->asSet()
else type.oclAsType(Classifier).allRealizedInterfaces()
endif

• basicRequired() : Interface [0..*]
The union of the sets of Interfaces used by the type of the 
Port and its supertypes.
---
body: type.oclAsType(Classifier).allUsedInterfaces()

The key to these two constraints seems to be the keyword type which must be found within the surrounding context of the type to which the constraint applies, since there is no feature named type declared in the description of Port, nor do any of its superclasses derive from Type.

We have the owner EncapsulatedClassifier which does derive from Type. However, there is no generalization or inheritance path between Interface and EncapsulatedClassifier as far as I can tell. They both specialize StructuredClassifier, but the owner of a Port must be an EncapsulatedClassifier, and there are no specializations of Interface to be found.

Where does the type in these two constraints come from?


Solution

  • type is not a keyword. It is the type Property inherited from Property.