The placement of a definition constraint in the UML metamodel is
shown
in Figure 30. The following well-formedness rule
must
hold. This rule also defines the value of the contextual Classifier.
context
ExpressionInOcl
def:
isDefinitionConstraint
: Boolean =
self.constraint.stereotype.name
= 'definition' -- A
and
self.constraint.constrainedElement->size()
= 1 -- B
and
self.constraint.constrainedElement.any(true).oclIsKindOf(Classifier)
-- C
context
ExpressionInOcl
inv:
isDefinitionConstraint
implies
contextualClassifier
=
self.constraint.constrainedElement.any(true).oclAsType(Classifier)
[3] Inside a definition constraint the use of @pre is not allowed.
context
ExpressionInOcl
inv: --