Validating uml models and ocl constraints
OCLin Ecore provides this capability for Ecore models.
Juno adds the dialog in which you can browse the File system or Workspace for one or more Complete OCL documents to load, or often more conveniently you can just Drag and Drop them from an Operating System Explorer or an Eclipse Explorer.
Behind the scenes, it is necessary to install global wrappers around all complemented packages.
The import statement is therefore an Eclipse OCL extension that is likely to be part of a future OCL specification revision.
Zero or more import statements may be present to specify the URIs of external model elements and optionally alias names for those elements.
By itself OCL is almost useless, since without any models to operate on, the constraints cannot achieve a great deal.
The simplest way to make OCL useful is to embed OCL expressions within a model to enrich the basic structural characteristics of a model with more complex behavior.
It is therefore necessary to restart the Sample Ecore Editor and Reload the modified Complete OCL document in order to exploit the changes.
In Juno, The Papyrus UML editor does not use the EValidator framework and so loading Complete OCL documents into Papyrus fails to enhance validation capabilities.
The readability of constraints can be significantly enhanced by the use of let-variables or the re-use, as above, of the The invariant name may be followed by a parenthesized OCL expression that computes a String to be used as the validation failure message.
The severity of a validation failure may be controlled by the non-true value evaluated by the invariant expression.
In the example: The Java API support for using Complete OCL documents with the Ecore and UML bindings requires implementation-specific magic; the imported models must be loaded into the package registry by the invoking code. Prior to the Juno release, import statements were not understood and so there was a usage conflict.