Re: OCL 2.0 formal/06-05-01
The Abstract Syntax defines expressions that navigate properties and
call operations of Classifiers: the PropertyCallExp and
OperationCallExp, respectively. These work well for features of
Classifiers that are defined by the UML model that is the subject of
the OCL constraints.
However, OCL also provides a mechanism for defining additional
attributes and operations on behalf of a classifier: the definition
constraint. As these definitions are extrinsic to the UML model,
there are no Property and Operation elements for the respective
expressions to reference. There are only Constraints with an
«oclHelper» stereotype and a body expression. The very purpose of
these definitions is to assist in the formulation of OCL constraints,
so it is necessary that the abstract syntax be able to reference them.
I can think of an obvious approach to resolution of this problem: add
an association "referredDefinition : Constraint" with 0..1
multiplicity to both of the existing PropertyCallExp and
OperationCallExp metaclasses. The 0..1 multiplicity of the existing
referredProperty and referredOperation associations, as shown in
Figure 8.3, appears to be in error (as the rest of the text and, in
particular, the well-formedness rules of Section 8.3.7, assumes the
reference to the referred features) but is required by this solution.
Additional well-formedness rules would stipulate, for each expression,
that exactly one of the referred feature of referred definition
associations have a value.
This suggestion is not entirely satisfactory, as it breaks the
uniformity of references to features in call expressions and encodes,
in the abstract syntax, a dependency on a feature's being an
additional definition. However, this problem is a practical concern
for the serialization and exchange of the OCL Abstract Syntax, as the
current metamodel is incomplete.