Automatically Binding Variables of Invariants to Violating Elements in an OCL-Aligned XBase-Language
XOCL4Inv is a language for expressing invariants of Ecore-based model in an OCL-aligned syntax. It is built using the Xtext framework and extends the Xbase Expression language.
The XOCL4Inv language makes it possible to add explicit parameters to invariants which are used to automatically bind invariant violating elements of iterator expressions with the same name and an assignable type.
XOCL4Inv was developed in the context of the Vitruvius Project.
Development and Usage
Prepare Development Environment
- Download and run the Mars 1 Release of the Eclipse IDE for Java and DSL Developers
- Install Subversive (SVN Team Provider) and a svn connector (e.g. SVN-Kit) using the Eclipse Marketplace
- Check-out the two plug-in projects of the XOCL4Inv language from the invariants branch of the Vitruvius svn repository (user: anonymous password: anonymous): edu.kit.ipd.sdq.xocl4inv and edu.kit.ipd.sdq.xocl4inv.ui
- If you also want to execute the evaluation transformations you can check-out all projects named *.xocl4inv.* except "rteval" inside the branch: Package Explorer context menu: Import - SVN - Project from SVN - ... - Find projects in the children of the selected resource
- Execute the Xtext MWE 2 Workflow for the XOCL4Inv language
- (If you have problems try to refresh the files from the filesystem, clean up your Eclipse build and do not close any of the plug-in projects named *.xocl4inv.*)
Run the XOCL4Inv editor
To run the XOCL4Inv editor a .xocl file has to be opened in project in a new Eclipse instance that is started from the Eclipse in which all plug-ins where checked out as specified above (this can be obtained e.g. by creating a new run configuration with default settings).
Make sure you set up all necessary dependencies in the runtime project in the new eclipse instance:
- If you do not create a new .xocl file in your runtime project you have to add the Xtext nature manually to it (otherwise you are asked in a dialog after creating a new file)
- You have to add a dependency to Xtend and the xocl4inv project to your runtime project e.g. by executing "convert to plug-in project" on the manifest file.
- The code for the metamodel for which you define invariants has to be on the classpath.
Evaluation using Synthetic and UML Invariants
Prepare Evaluation Environment
- install Eclipse OCL 6.0.1 from the Eclipse Marketplace
- check-out all evaluation projects except edu.kit.ipd.sdq.xocl4inv.rteval (if you have not checked them out together with xocl4inv and xocl4inv.ui, their names are ...xocl4inv.eval, ...xocl4inv.eval.model, ...xocl4inv.eval.ui)
- run the Xtext MWE2 Workflow for the XOCLEval language
- run a new Eclipse instance (as described in the previous section)
- in the new runtime Eclipse import the ...xocl4inv.rteval project from svn
Run the JUnit Tests of the Evaluation
- navigate to the folder "xtend-gen/edu.kit.ipd.sdq.xocl4inv.eval.xbaseocl", which is automatically generated from the .xeval files in the src folder
- ocl_collection.xeval and src/ocl_iterate.xeval define equivalent invariants in OCL and XOCL4Inv and check for input models whether they return the same result
- right-click on the xbaseocl folder an select "Run As - JUnit Tests" to run all tests in the folder
- navigate to the folder "xtend-gen/edu.kit.ipd.sdq.xocl4inv.eval.transformation", which is also automatically generated from the .xeval files in the src folder
- src/artificial_invariants.xeval generates the synthetic invariants and src/artificial_transformation.xeval generates the JUnit Tests, which transform the invariants and check for input models whether the correct elements are retreived
- right-click on the transformation folder an select "Run As - JUnit Tests" to run all tests in the folder
- manually inspect the UML invariants, which we formulated in XOCL4Inv according to the OCL original, in src/uml_invariants.xeval
- the result of the transformation to obtain violating elements can be found in "src-gen/edu.kit.ipd.sdq.xocl4inv.eval.invariants" (not in xtend-gen as it is the case for the synthetic invariants)
Jira Project
Please report bugs using the JIRA Issue Management for Vitruvius
Documentation
The XOCL4Inv language and parameter binding algorithm are described in an article that is currently under revision. It will be linked and probably accompanied by a technical report as soon as the article is published.