Tutorial

Overview

This tutorial explains how to specify and execute bidirectional model transformations within the JTL tool. 

These instructions are based on the Collapse/Expand State Diagrams benchmark. Starting from a hierarchical state diagram (involving some one-level nesting), a flat view has to be provided. Then adding a transition between two flatten states cannot be back-propagated in a unique way, since the corresponding transition in the hierarchical state diagram can be added to any nested states as well as to the container state itself.

Modelling State Machines

The hierarchical and non-hierarchical state machine metamodels (respectively SimpleHierarchicalStateMachine and SimpleStateMachine) are given by means of their Ecore representation within the EMF-based framework.

Then a hierarchical state machine model conforming to the SimpleHierarchicalStateMachine metamodel can be specified

Specifying the HSM2SM bidirectional transformation

Starting from the definition of the involved metamodels, the JTL transformation is specified.

Executing the HSM2SM bidirectional transformation

The transformation can be easily executed from: Right-Click menu > Run as > Run Configurations

The application of the transformation on HSM generates the corresponding SM model.

Note that, by re-applying the transformation in the backward direction it is possible to obtain again the HSM source model. The missing sub-states and the transitions involving them are restored by means of trace information.

Propagating changes

Suppose that in a refinement step the designer needs to manually modify the generated target by adding the transition [alternative = try again] to the state Disk Error to come back to Install Software.

If the transformation HSM2SM is applied on it, changes are propagated on the source model.

The tutorial is available in the JTL workspace attached to the JTL tool, that can be downloaded here. The source code of the tutorial can also be downloaded here