Visual OCL

TU-Berlin | Faculty IV | Institute ISTI | Research group TFS

Language Description

small logo
section: < previous | next >
| |
chapter: << previous | next >>

OCL Constraints

To restrict the set of instances of the VOCL meta model there have been defined nearly 100 OCL constraints. The following three just give an example of them:

1. ArithmExp

The types of the arguments belonging to the ArithmExp have to be equal:
context ArithmExp inv:
if self.literal->size()=1 then self.type=self.literal.type
else (if self.variable->size()=1
then self.type=self.variable.type
else self.type=self.op.type)

2. BooleanExp

The arguments are VOCL expressions of the same constraint:
context BooleanExp inv:
self.arg1.constraint= self.arg2.constraint= self.constraint


3. Path

The ClassifierRoles respectively the CollectionRoles, that are referenced by AssociationRoles or AssociationClassRoles in a Path, have to be nodes of this Path:
context Path inv:
self.arnode->forall(a:AssociationRole|
a.start.participant.path=self and a.end.participant.path=self) and
self.arnode->select(ar:AssociationRole|
ar.oclIsTypeOf(AssociationClassRole))->forall(a:AssociationClassRole|
a.referredClassifierRole.path=self)

The constraints together with the meta model define the language VOCL. Alternatively there is a formal definition with the graph grammar approach. Just select it on the top left navigation.


  section: < previous | next >
| |
chapter: << previous | next >>
©2005 TFS