In order to foster the evolution of OCL Tools, user input is important. If you're using OCL Tools, please add yourself to this list, as a first step towards building a community. Literature reflecting best-practices is also welcome (and somewhat scarce as of now :-)

<b>I invoke the compiler but no code gets generated. What can I do?</b>

+

+

The OCL compiler should generate code when invoked with both

+

+

<pre>

+

<yourFileName>.ecore

+

<yourFileName>.ocl

+

</pre>

+

+

on the same folder. Moreover, the .ocl file should be of the form

+

+

<pre>

+

package <packageName>

+

+

context <myClass>

+

...

+

+

endpackage

+

</pre>

+

+

There is guidance about that in the exampled co-delivered with the source code, in plugin

+

<pre>de.tuhh.sts.ocl.example.royalandloyal</pre>

+

+

If all else fails, actually the shortest way to see why the compiled Java does not end up in .java files is to place a breakpoint at method

+

+

<pre>

+

public void compile(IFile ecoreFile, IProgressMonitor monitor)

+

</pre>

+

+

in class <code>OCLCompiler</code> in plugin <code>de.tuhh.sts.ocl.compiler.emf.compiler</code>

+

+

Actually, that's where the action is. The rest is just glue code so that those generated methods bodies are woven as part of EMF code generation (which generates method signatures, class skeletons, etc.)

+

+

The JET templates co-delivered with the OCL compiler override some hooks in the JET templates of EMF CodeGen, and when those templates change the hooks might not be there any more. For a discussion of this and what to do about it, take a look at:

Latest revision as of 07:46, 9 October 2008

The MDT-OCLTools Project has closed. This page has been locked and is for Archival purposes only.

OCL Tools is a recently added component to the
Model Development Tools (MDT) Project
aiming at providing first-class support to modelers
working with specifications containing expressions written in OCL, the
Object Constraint Language. Such support
includes editing, refactoring, code generation, execution, and
interactive debugging of the OCL constraints given for some underlying
(Ecore or UML2) class model. The functionality of OCL Tools builds upon
the MDT OCL component, and has been seeded with two initial
contributions:

an OCL -> Java compiler, that as of now takes as input an
.ecore and a textual file containing OCL constraints (handling UML2 is
in the ToDo list). This compiler extends EMF code generation, producing
Java 5 source code with side-effects-free methods for the given OCL
invariants, pre- and postconditions, and derived attributes and
operations.

an OCL text editor, supporting usability features such as
AutoCompletion, navigation by means of hyperlinks, structured views
(for the outline of a document and for the Abstract Syntax Tree of an
OCL constraint), among others. Although MDT OCL itself is completely
fluent in both Ecore and UML2, only the Ecore binding is supported by
the OCL text editor at this time.

How to install

User Community

In order to foster the evolution of OCL Tools, user input is important. If you're using OCL Tools, please add yourself to this list, as a first step towards building a community. Literature reflecting best-practices is also welcome (and somewhat scarce as of now :-)

There is guidance about that in the exampled co-delivered with the source code, in plugin

de.tuhh.sts.ocl.example.royalandloyal

If all else fails, actually the shortest way to see why the compiled Java does not end up in .java files is to place a breakpoint at method

public void compile(IFile ecoreFile, IProgressMonitor monitor)

in class OCLCompiler in plugin de.tuhh.sts.ocl.compiler.emf.compiler

Actually, that's where the action is. The rest is just glue code so that those generated methods bodies are woven as part of EMF code generation (which generates method signatures, class skeletons, etc.)

The JET templates co-delivered with the OCL compiler override some hooks in the JET templates of EMF CodeGen, and when those templates change the hooks might not be there any more. For a discussion of this and what to do about it, take a look at: