Search code examples
language-lawyerumlocl

OCL implementation of UML operation "Classifier::directlyUsedInterfaces()"


On page 177 of the UML 2.5.1 specification under section 9.9.47 "Operations" for Classifier, we have the following operation definitions:

directlyRealizedInterfaces() : Interface [0..*]
The Interfaces directly realized by this Classifier

body: (clientDependency->select(
           oclIsKindOf(Realization) 
       and supplier->forAll(oclIsKindOf(Interface))))->
           collect(supplier.oclAsType(Interface))->asSet()

This is fairly straightforward to implement, for example in C++, since there is a property clentDependency defined for NamedElement which is one of the base classes for Classifier.

However, the next operation is problematic:

directlyUsedInterfaces() : Interface [0..*]
The Interfaces directly used by this Classifier

body: (supplierDependency->select(
           oclIsKindOf(Usage) 
       and client->forAll(oclIsKindOf(Interface))))->
           collect(client.oclAsType(Interface))->asSet()

The problem is that there is no property supplierDependency in NamedElement. Perhaps there used to be one and it was removed? I came across this reference WRT supplierDependency: https://www.site.uottawa.ca/~tcl/gradtheses/mnojoumian/ThesisFiles/FinalSpec/UML/7.3.33.html

I suppose this could be implemented similar to the NamedElement::clientDependency() body:

body: Dependency.allInstances()->select(d | d.client->includes(self))

using supplier instead of client?


Solution

  • There actually is a property supplierDependency defined on NamedElement as you can see in the UML specification Abstract Syntax

    This is also present in the xmi file for version 2.5. This is an image of the resulting model in EA after importing the xmi file.

    imported in EA