Saying Hello World with VIATRA2 - A Solution to the TTC 2011 Instructive Case
The paper presents a solution of the Hello World! An Instructive Case for the Transformation Tool Contest using the VIATRA2 model transformation tool.
š” Research Summary
The paper presents a comprehensive solution to the āHello World! An Instructive Caseā from the Transformation Tool Contest (TTC) 2011, using the VIATRA2 model transformation framework. The authors first outline the architectural foundations of VIATRA2, emphasizing its use of the Visual and Precise Metamodeling (VPM) approach, which allows arbitrary metalevels and thus seamless integration of models from heterogeneous domains such as BPM, UML, XSD, and EMF. This flexibility is a key differentiator from traditional MOFābased metamodeling.
VIATRA2ās transformation language, VTCL (VIATRA2 Textual Command Language), combines graph transformation (GT) and Abstract State Machine (ASM) concepts. GT rules are declarative, specifying leftāhandāside (LHS) and rightāhandāside (RHS) patterns, while ASM rules provide sequential command execution, temporary variables, and functions. The paper demonstrates each subātask of the case study with two variants: an ASMācentric implementation and a GTācentric implementation, thereby showcasing the tradeāoffs between declarative patternābased manipulation and explicit procedural control.
The seven subātasks are:
-
Hello World! ā Creation of a simple model, a modelātoāmodel mapping, and a modelātoātext output. The ASM version builds objects stepābyāstep; the GT version captures the whole structure in a single pattern rewrite.
-
Count Matches with Certain Properties ā Counting elements that satisfy a property. The ASM variant uses a
forallconstruct to iterate over matches, while a forthcoming matchācounting feature (still experimental) promises a more concise expression. A library of reusable graph patterns is stored in a separate VTCL file and imported where needed, illustrating modularity. -
Reverse Edges ā Reversing the direction of all edges in a graph. The ASM variant exploits VIATRA2ās dynamic type modification to switch the role of
srcandtrgrelations without recreating elements. Two GT variants are provided: one that rewrites each edge, and a third that swaps the targets of thesrcandtrgrelations. Conditional constructs (if,try) make the solution tolerant of dangling edges. -
Simple Migration ā Transforming an input graph to conform to a different metamodel. Both a copyābased approach (creating a new graph in the target metamodel) and an ināplace retyping approach (changing the type of existing elements) are implemented. The ināplace variant highlights VIATRA2ās ability to manipulate metamodels at runtime, a powerful feature for migration scenarios.
-
Delete Node with Specific Name and Its Incident Edges ā Deleting a node identified by a name and all incident edges. Implementations are provided in both ASM and GT, with optional extensions for conditional deletion.
-
Insert Transitive Edges ā Adding direct edges between nodes that are reachable via an intermediate node (2āhop) and, in later variants, iteratively until the transitive closure is complete. Three versions are presented: (a) a singleāstep 2āhop insertion, (b) a looped version that repeats until no more edges can be added, and (c) a singleāstep insertion using a recursive graph pattern that captures full transitive reachability. The recursive pattern demonstrates VIATRA2ās support for recursion, though the current incremental matcher cannot handle cycles correctly, so the localāsearch matcher is used for this case.
The authors discuss the two patternāmatching strategies available in VIATRA2: localāsearch (LS) and incremental (INC). LS consumes more memory but is robust for all cases; INC offers faster execution and lower memory usage but has limitations with cyclic graphs and recursive patterns. Most tasks use INC, while the transitiveāclosure task falls back to LS.
Key insights highlighted include:
- Reusability ā Common patterns are externalized and imported, enabling a libraryālike reuse across multiple transformations.
- Dynamic Typing ā The ability to change the type of model elements at runtime simplifies ināplace migrations and edgeāreversal tasks.
- Recursive Matching & Match Counting ā Although still experimental, these features allow concise expression of complex graph analyses such as transitive closure and propertyābased counting.
- Multiple Implementation Variants ā Providing both ASM and GT versions for each task serves as an instructional guide, illustrating when to favor declarative pattern rewriting versus explicit procedural steps.
The paper also acknowledges limitations: VIATRA2 does not natively handle EMF models, requiring import/export steps; VTCLās syntax can be verbose, potentially obscuring the simplicity of the underlying transformation logic. Nonetheless, the authors argue that the āHello World!ā case, being intentionally simple, serves as an excellent benchmark for comparing transformation tools and showcases VIATRA2ās flexibility, extensibility, and expressive power.
In conclusion, the work delivers a thorough, multiāvariant solution to the TTC 2011 instructive case, demonstrating VIATRA2ās capabilities in model construction, querying, manipulation, migration, and advanced pattern matching, while also providing practical insights into performance tradeāoffs and tool integration challenges.
Comments & Academic Discussion
Loading comments...
Leave a Comment