
h1. Examples

h2(#RoyalAndLoyalExample). Royal and Loyal Example Project

The RoyalAndLoyal example project provides a substantial example of a Complete OCL document
complementing an independent Ecore meta-model.

This is the standard example used in many OCL texts and courses. It was first produced as part of
the _The Object Constraint Language Second Edition_ by _Jos Warmer_ and _Anneke Kleppe_.

This example may be used to explore a wide variety of OCL syntaxes and their presentation in the Complete OCL editor.

You may install the example by selecting *Example...* from the *New* menu, then selecting *Royal and Loyal Example* under the *OCL (Object Constraint Language) plugins*.

Open *RoyalAndLoyal.ecore* with the OCLinEcore editor to explore the Ecore metamodel. Note how the Outline can be alphabeticized and so provide a useful overview. The outline very similar to the conventional Sample Ecore Editor tree view.

Open *RoyalAndLoyal.ocl* with the CompleteOCL editor to explore the OCL. Note how the full AST can be explored in the Outline.

h2(#EmptyExample). Empty Example Project

The Empty example project creates an empty project with a Java class path set up to assist in the use of OCL.

This assistance is not really necessary now that the editors are based on Xtext and now that an XMI representation is not automatically saved in a *bin* directory.

The OCL editors can be used wherever Ecore editors can be used. 

It is not necessary for a project to have a Java nature.

It is not necessary for a project to have an Xtext nature. If you add an Xtext nature, your OCL files will be built automatically when other files in the project or its dependencies change. This can significantly clutter the Problems View if you have problems with your OCL, and may significantly increase build times.

h2(#OCLinEcoreTutorialExampleProject). OCLinEcore Tutorial Example Project

The OCLinEcore Tutorial project provides the conclusion of the "OCLinEcore Tutorial":OCLinEcoreTutorial and the material for the "Getting Started":GettingStarted quick introduction.

The project provides an example of OCL embedded in Ecore that is also used by the "Code Generation Tutorial":#CodeGenerationTutorial and "Debugger tutorial":#DebuggerTutorial. 

h2(#CompleteOCLTutorialExampleProject). Complete OCL Tutorial Example Project

The Complete OCL Tutorial project provides examples for the the "Complete OCL Tutorial":CompleteOCLTutorial.

The project provides examples Complete OCL documents that complement Ecore, UML, Xtext and XMI.

