Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
VIATRA2/UseCases/DebuggingAndVisualisation
Contents
Transformation Debugging in VIATRA2
The VIATRA2 framework does not contain a dedicated debugger, but there are other features that can be used to support debugging. These are:
- Output rules
- The VIATRA Console
- Undoable Transformations
- Executing Single Rules
- Model Space Visualisation
Output rules
The print
and println
rules can be used to output the value of any selected transformation program variable to the output. A typical use would be to output the matches of the precondition in the action part of a graph transformation rule:
gtrule rule(in Token) = { precondition find token(Token) action { println(Token); } }
The VIATRA Console
The VIATRA framework provides a VIATRA2 Console view that is capable of displaying the messages of the framework, and allowing the execution of commands. By default the debug messages are disabled because of their possible large number - it is only recommended to turn it on while it is explicitely needed.
The commands of the console can be listed used the listcommands
code together with a short description. The Console supports command name auto-completion, by using the tab key.
Executing single rules
During debugging it is a common need to run only a single ASM rule of the transformation program, not the whole of it. The runrule
allows executing a single rule of the transformation on the current model space.
Undoable Transformations
When executing a transformation program from the user interface of the framework, it changes the model space (although these changes are not saved into a file, so it is possible not to save the unnecessary changes).
During transformation development it is a common need to execute the same transformation program on the same model, so it is important to revert the changes of the transformations, but the runtime performance of such a solution makes it inadvisable as a default solution.
On the other hand the runmachineundoable
and runruleundoable
commands can execute ASM machines or a single ASM rule in a way that the undotransaction
command can undo all of their changes. This option might speed up the debugging process by eliminating the closing and opening of model spaces.
Model Space Visualisation and Debugging
The model space visualisation component can be used to view a part of the model space as a graph, and it also reacts to changes of the model space: when a displayed model element changes (e.g. after the execution of a rule it is deleted), the changes are immediately reflected on the visualisation (e.g. the related node is deleted).
It is important to note that the model space visualisation component only helps to understand the actual state of the model space, but it does not contain any option to alter it.