The ExpressionInOcl Type
Because in the abstract syntax OclExpression is defined recursively, we
need a new metaclass to represent the top of the abstract syntax tree
that
represents an OCL expression. This metaclass is called ExpressionInOcl,
and it is defined to be a subclass of the Expression metaclass from the
UML core, as shown in Figure 29. In UML (1.4) the Expression metaclass
has an attribute language which may have the value 'OCL'. The body
attribute
contains a text representation of the actual

expression. The bodyExpression association of ExpressionInOcl
is
an association to the OCL expression as represented by the OCL Abstract
syntax metamodel. The body attribute (inherited from
Expression)
may still be used to store the string representation of the OCL
expression.
The language attribute (also inherited form Expression) has the value
`OCL'
.
ExpressionInOcl
An expression in OCL is an expression that is written in OCL. The value
of the language attribute is therefore alwaysequal to `OCL'.
Associations
-
contextualClassifier The classifier that is the
context of the OCL expression. Self is always an instance of this
classifier.
The contextualClassifier is always a derived association. In
the
remainder of this chapter many derivations will be given.
-
bodyExpression The bodyExpression
is an OclExpression that is the root of the actual OCL
expression,which
is described fully by the OCL abstract syntax metamodel.