Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The Object Constraint Language(OCL) is an expression language that can be used with Ecore to specify constraints, derived features and operation bodies. To make including OCL in models easier, a(nother) textual language has been designed for Ecore, which includes using the OCL syntax for constraints, derived features and operation bodies, in addition to a more Java-like syntax for the ordinary model elements. The custom OCLinEcore Editor supports this languages, while still using the standard XMI-based serialization of Ecore as storage format, so it interoperates nicely with other tools. This means you can open any ecore file in this editor, edit the model and save the file, still using the XMI-based ecore file format. This is different from Xcore's approach (see below), where the storage format is the same as the editor's language.

An example of the language is shown to the right. Almost at the bottom, the invariant keyword introduces the 'oneManager' constraint, where OCL is used for specifying the logic. See wiki page and help page for more about OCLinEcore.

Note that support for OCL must be installed on top of the standard modeling package using the OCL Examples and Editors SDK feature from the main Eclipse installation site.