This assignment is about using Triple Graph Grammars (TGGs) for model transformation.
In our example, we transform a simple version of automata into a corresponding Petri net.
There are three main steps and tasks. The first task is installing the TGG tool (as an extension of Eclipse)
and using it along with an example coming with the TGG interpreter (similar to the
example from the lecture). The second task is to come up with conceptual TGG rules for translating a simple automaton into an equivalent Petri net. The last task is realising the rules from task 2 in the TGG tool, so that the rules can be used for transforming the
automaton from an example project into a Petri net.
I suggest that you do the first two tasks in the first week (up to week 12), and get started with the third in the first
week already. The 3rd task should then be finished in week 13.
- Install the TGG-interpreter in your workbench. To this end:
- Install the TGG interpreter by Joel Greenyer on
your Eclipse platform.
You will find the instructions at http://www.cs.uni-paderborn.de/en/research-group/software-engineering/research/projects/tgg-interpreter/installation.html
,
where you can install the TGG interpreter from an update site.
In short: install the "TGG Interpreter SDK" feature and
at least the "TGG ctools2pntet Example Feature" from the update
site (https://svn-serv.cs.uni-paderborn.de/updatesites/trunk/de.upb.swt.qvt.tgg-updatesite/3.7/) — it works also for Eclipse Luna 4.4.
- Test your installation (as described on the web page) and do the "ctools2pnet" tutorial
from the web site
http://www.cs.uni-paderborn.de/en/research-group/software-engineering/research/projects/tgg-interpreter/tutorials.html.
- When you succeeded, slightly change the TGG-rules. For example, change the transformation of a
connection so that it generates two Petri net arcs, one in every direction.
- Make a meta-model for simple automata with an initial state (you can use the one from task 3 below,
if you want) and for Petri nets (see Assignment 1, task 2). Make TGG-rules that
translate an automaton to an equivalent Petri net: Every state of the automaton should
be translated to a place of the Petri net, every transition of the automaton should be translated to
a transition of the Petri net (connected with arcs to the respective places). And the place corresponding
to the initial state should have one token. All other places should be unmarked. How many rules did
you need?
- Implement the rules from task 2 in the TGG Interpreter and translate some automata
to Petri nets by the
help of the TGG-Interpreter (you might look at the guidelines and videos at
http://www.cs.uni-paderborn.de/en/research-group/software-engineering/research/projects/tgg-interpreter/tutorials.html
and the tutorials available there).
Note that you must also create a meta-model for the correspondence nodes of your rules,
but it is enough, if this meta-model is created and referenced in your run-time workspace, where
you also create your TGG-rules (see structure ctool2pn example).
Note that it is important that the meta-models for automata and Petri nets are also available
in the run-time workbench (you can use the copies that are available in the run-time workbench
project in folder "metamodels" already).
Here are the necessary steps in more detail:
- Make sure that the Petri net model (and the editor) from
Assignment 1 (task 2) is
installed in your workspace (if not, you can install it together with the automaton in the next step).
- Install the projects (model, edit, and editor) for a simple
automaton from TGG-Tutorial-workspace-setup.zip
in your workspace.
- Start your runtime-workbench now and install a project in which
some models and files are prepared already from
TGG-Tutorial-runtime-workspace-setup.zip
in your runtime workspace.
The folder "models" contains a simple example of an automaton
(source.automaton).
The automaton should be transformed into a Petri net.
- Create a meta-model for the correspondence nodes (e.g. in the
folder correspondence-model) or use
the one that is comming from the example setup project above.
- You will find a simple TGG with an axiom and some (non-complete) rules already. Complete
these rules (see task 2) with the TGG editor (see vidoes) and finish the TGG.
- Create a TGG configuration by selecting the source model (source.automaton) and the TGG
(A2PN.tgg) and, on a right-click, chose "TGG Interpreter" -> "create forward transformation
interpreter configuration" and select the correspondence model in the opened dialog.
- Right-click on the created configuration (source.interpreterconfiguration), and chose
"TGG interpreter" -> "perform configured configuration". Inspect the created files
(if you want to view the Petri net graphically, initiate "Initiallize perinets_diagram diagram file"
by a right-click). Make sure that your transformation works correctly.
|