SimpleOCL
Introduction
SimpleOCL is a proof-of-concept implementation of the OCL standard. SimpleOCL is built on top of the Eclipse Modeling Framework (EMF)and EMFText, and is intended as an embeddable OCL implementation for inclusion in transformation languages for the EMF Transformation Virtual Machine (EMFTVM), such as SimpleGT. EMFTVM allows integrated execution of heterogeneous model transformation languages, much like Microsoft's Common Language Runtime (CLR). EMFTVM is currently part of the Eclipse ATL project, and also provides a compiler for ATL.
Below you can find an example of SimpleOCL code:
This code defines a couple of attributes and operations. Note that we've added the Lambda type, so you can define your own iterator expressions, e.g.:
list->map(x | x*2)
To facilitate better integration with Java code, we've also added support for static attributes/operations. These are invoked using the :: operator instead of the . operator. Finally, all attributes/operations without a defined context fall in the Env context, which stands for the environment. The environment has a single runtime instance, which can be accessed using the env keyword. The environment is mapped to EMFTVM's ExecEnv metaclass, which allows access to specific runtime information.
SimpleOCL does not support OCL's pre, post, and inv declarations. It is intended as a navigation language to be embedded in model transformation languages, and therefore only supports def declarations. That said, EMFTVM's integration with Java allows you to do much more.
Contact
System Requirements
You'll need the following installed on your computer:
Download & Install
To download and install the SimpleOCL Eclipse plugin, install it from either of the following Eclipse update sites:
- http://soft.vub.ac.be/eclipse/update-3.7/ for Eclipse 3.7
See links for the source code.
Running SimpleOCL/EMFTVM modules
Note that SimpleOCL modules don't do anything normally, unless you define a static main operation:
static def : main() : OclAny = ...
EMFTVM includes a separate launch configuration dialog that looks very much like ATL's launch configuration dialog. It can be found via “Run → Run Configurations…”.
EMFTVM also includes its own Ant tasks. See this example build.xml file to find out how to use the Ant tasks.
Links
- SimpleOCL source code: http://soft.vub.ac.be/viewvc/SimpleOCL/


