Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

VIATRA2/GettingStarted/Creating Transformations

The VIATRA2 transformation language

VIATRA2 has its own programming language called VTCL. Transformations written in VTCL are stored in .vtcl files, and each of them describes a so-called machine of the GTASM formalism. The definition of the control flow of the transformation is similar to the mathematical formalism of Abstract State Machines (ASM), and looks just like a conventional programming language (with a syntax somewhat resembling C); this is extended by the declarative features of Graph Transformation (GT).

Why would you want to write transformations in VTCL, instead of implementing them in a well-known programming environment like Java? First, VTCL has convenient access to the VPM model space, which acts as a common ground between heterogeneous modeling formalisms (although VPM also has a Java API). But more importantly, VTCL is a specialized language tailored to transformation specification, having language constructs for efficiently processing models, such as declarative model queries and even declarative manipulation. Should you still find the capabilities of VTCL limiting, there are ways to plug in arbitrary Java code.

The official page hosts the official (slightly outdated) transformation language specification. This page of the wiki, aims to give a short tutorial of the language. A more elaborate tutorial is also available. The VIATRA2 wiki also contains additional reading material including important usage patterns and more advanced topics.

Language features: GTASM

The VTCL language is a textual syntax to define GTASM program models. GTASM is a combined approach that integrates two popular, intuitive, yet mathematically precise rule-based specification formalisms [1] , namely, graph transformation (GT) and abstract state machines (ASM) to manipulate graph based models.

  • Graph patterns are the key concept in defining model transformations within VIATRA2. A pattern is a declarative query, specified by a collection of model elements arranged into a certain structure fulfilling additional constraints (as defined by attribute conditions or other patterns). Patterns can be matched on certain model instances.
  • Graph transformation (GT) [2] provides a declarative, high-level rule- and pattern-based manipulation language for graph models. Graph transformation rules can be specified by using a left-hand side -- LHS (or precondition) pattern determining the applicability of the rule, and a right-hand side -- RHS (postcondition) pattern which declaratively specifies the result model after rule application. Elements that are present only in (the image of) the LHS are deleted, elements that are present only in the RHS are created, and other model elements remain unchanged. VIATRA2 also allows the definition of imperative actions associated with this formalism.
  • Complex model transformation can be assembled from elementary graph patterns and graph transformation rules using abstract state machine (ASM) [3] in case of the VIATRA2 framework. ASM provides complex model transformations with all the necessary control structures including the sequencing operators, rule invocation, variable declarations and updates, GT rule invocation etc.

More information on the semantic integration between graph transformation and abstract state machines can be found in [4].

Transformation Development

In order to learn the VTCL transformation language, it is recommended to start at the Hello World example. Afterwards, a more advanced tutorial is available, that walks the reader through the creation of a transformation from UML Activities to the domain of Petri Nets.

More detailed information on the transformation language is available on the wiki.

References

  1. Varró, D., Balogh, A.:The model transformation language of the VIATRA2 framework. Sci. Comput. Program. 68(3) (2007) 214-234
  2. Ehrig, H. et al.:Handbook on Graph Grammars and Computing by Graph Transformation. Volume2 : Applications, Languages and Tools. World Scientific (1999)
  3. Börger, E ., Sark, R.: Abstract State Machines. A method for High-Level System Design and Analysis. Springer-Verlag (2003)
  4. Varro, D.: Automated Model Transformations for the Analysis of IT Systems, Ph.D. thesis, Budapest University of Technology and Economics, Department of Measurement and Information Systems (2004).

Copyright © Eclipse Foundation, Inc. All Rights Reserved.