Saying HelloWorld with QVTR-XSLT - A Solution to the TTC 2011 Instructive Case
In this short paper we present our solution for the Hello World case study of the Transformation Tool Contest (TTC) 2011 using the QVTR-XSLT tool. The tool supports editing and execution of the graphical notation of QVT Relations language. The case study consists of a set of simple transformation tasks which covers the basic functions required for a transformation language, such as creating, reading/querying, updating and deleting of model elements. We design a transformation for each of the tasks.
💡 Research Summary
The paper presents a complete solution to the “Hello World” case study of the Transformation Tool Contest (TTC) 2011 using the QVTR‑XSLT tool, which combines a graphical editor for QVT Relations (QVTR) with an XSLT code generator. The authors first describe the architecture of the tool: a graphical editor built on top of MagicDraw UML that allows users to define metamodels as simple class diagrams, to model QVTR relations, queries, and functions visually, and to validate the design; and a code generator that reads the XML representation of the graphical model and produces a pure XSLT stylesheet that can be executed by any standard XSLT processor such as Saxon 9. A lightweight Java runner is also provided to invoke the generated stylesheet and to handle transformation parameters, inheritance through rule overriding, multiple input and output models, and in‑place modifications.
The case study consists of seven distinct transformation tasks, each illustrating a core capability required of a model transformation language: creation, reading/querying, updating, and deletion of model elements.
-
Hello World (constant transformations and model‑to‑text) – Two constant transformations are defined using a single top‑level relation each. The source metamodel is SimpleGraph, which already exists in the test suite, and the target metamodels are HelloWorld and HelloWorldExt. The transformations simply assign fixed string literals to attributes. A third transformation maps the HelloWorldExt model to an HTML metamodel, producing a web page that displays the greeting.
-
Counting matches with certain properties – Four queries are modeled graphically to count nodes, isolated nodes, looping edges, and dangling edges. The OCL
size()operation is used within the queries, and the results are stored in a Result metamodel. An additional XSLT‑implemented functionGetAllCircleNodescomputes the number of three‑node cycles (k‑circles) by invoking a helper XSLT functionGetCircleNodesand a queryGetLinkedNodes. This demonstrates seamless integration of hand‑written XSLT code with automatically generated QVTR logic. -
Reverse edges – An in‑place transformation copies a SimpleGraph model while swapping the source and target of each edge. Three top‑level relations handle copying of graphs, nodes, and edges, ensuring that dangling edges are correctly processed.
-
Simple migration – Using the EvolveGraph metamodel as the target, the migration is expressed with three top‑level relations that copy graphs, nodes, and edges respectively.
-
Topology‑changing migration – With the MoreEvolveGraph metamodel, only two top‑level relations are needed for graphs and nodes; a query retrieves destination nodes for each source node, illustrating how structural changes can be expressed compactly.
-
Delete node with specific name and its incident edges – This task is performed as an in‑place transformation. Two relations mark the node named “n1” and all incident edges for removal by setting the
xmiDiffOpattribute to “remove”. The transformation engine collects these modifications into a diff model and applies them to the original model automatically. -
Insert transitive edges – Three relations copy the original graph, then two queries obtain the set of destination nodes reachable from a given node (excluding the node itself) and the set of existing edges between any two nodes. The
LookTransitiverelation computes the transitive closure and invokes theInsertEdgerelation to create the missing transitive edges.
The authors provide a quantitative evaluation in Table 1. For each task they report the number of relations, queries, and functions, the number of generated XSLT lines, and the total execution time (including model loading and saving) on a modest laptop (Intel 2.13 GHz, 3 GB RAM, Windows 7). Execution times range from 47 ms for the simplest constant transformation to 139 ms for the transitive‑edge insertion, demonstrating that the generated XSLT is efficient despite being derived from a high‑level graphical specification. Notably, only about 30 lines of XSLT were hand‑written (for the cycle‑counting function); the remainder was automatically generated from the QVTR diagrams.
In the conclusion, the paper argues that the QVTR‑XSLT tool successfully bridges the gap between the declarative, diagrammatic nature of QVTR and the procedural power of XSLT. By allowing users to define transformations visually, automatically generating executable XSLT, and supporting advanced features such as parameterisation, rule inheritance, multi‑model handling, and in‑place updates, the tool proves suitable for both instructional purposes (as demonstrated by the “Hello World” case) and more realistic model migration scenarios. The authors suggest future work on scaling to larger models, performance optimisation, and integration with other transformation languages. Overall, the paper provides a compelling demonstration of how a relatively lightweight, graph‑based transformation environment can be used to solve a complete set of model transformation tasks in a concise, maintainable, and performant manner.
Comments & Academic Discussion
Loading comments...
Leave a Comment