Automatically Binding Variables of Invariants to Violating Elements in an OCL-Aligned XBase-Language

Aus SDQ-Wiki

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

  1. Download and run the Mars 1 Release of the Eclipse IDE for Java and DSL Developers
  2. Install Subversive (SVN Team Provider) and a svn connector (e.g. SVN-Kit) using the Eclipse Marketplace
  3. 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
  4. 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:

  1. 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)
  2. 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.
  3. 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

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
  • 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
  • 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.