If you use Eclipse OCL within Eclipse you should find that the appropriate registrations are provided for you automatically by the plugin registration mechanisms.
However if you use Eclipse OCL outside Eclipse, for instance in JUnit tests, you must provide the corresponding registrations in your code.
For the Ecore metamodel, the required registrations should be provided by invoking
This may be invoked with a null argument to install the registrations in the global EPackage.Registry. This is not normally recommended, but since this is for your application, the integrity of the global registry is your responsibility.
It is normally recommended to install the registrations solely for use in your own ResourceSet and to pass that to the initialize routine.
This initialization ensures that *.ecore is understood.
If you want to use EMF delegates to dispatch OCL, the required registrations may be
This may be invoked with a null argument to install the registrations in the global EPackage.Registry rather than a specified local registry.
For the UML metamodel, the required registrations should be provided in a similar way by invoking
This initialization ensures that *.uml is understood that http://www.eclipse.org/ocl/1.1.0/oclstdlib.uml is known and that standard pathmap: locations are resolvable. It also invokes
org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(ResourceSet) to ensure that all Eclipse and OMG UML namespaces and extensions are registered..
The Xtext Editors use the Pivot binding and so their initialiation is described in “Pivot Standalone Configuration”#PivotStandalone.
The Xtext editors may be used with the Ecore or UML bindings in so far as the Complete OCL editor provides a *.ocl document that may be parsed by the LPG parser, and the OCLinEcore editor provides embedded OCL that may be executed by either evaluator.