What is Eclipse VIATRA?

The Eclipse VIATRA project provides a model query and transformation framework that helps to move information back and forth between various documents and models in the most efficient way. The framework supports the reactive programming paradigm by event-driven transformations that can happen on-the-fly as the models change.

While trivial transformations (for instance copying pieces of data from one document to another) are easy to solve with any programming language, the task quickly becomes too challenging for those who need to enforce complex design rules or produce live reports.

VIATRA is a long-running project that incorporates the results of over 15 years of active research and development to solve this issue. The framework offers an efficient Java runtime library that is easy to embed, e.g. with limited dependencies. In addition to that, dedicated domain-specific query and transformation languages are available, motivated by the concepts of graph patterns and graph transformations.

Listing 1: A query over state machines expressed as a graph pattern

To illustrate the capabilities of VIATRA, a complete model case study called CPS demonstrator was created. The showcase includes model queries, transformations in multiple styles (batch, live, target incremental, etc.) and a model generator. Furthermore, the ease of embedding VIATRA is demonstrated by creating a dedicated modeling application that integrates all these features.

Query and transformation performance depends on the domain complexity and the size of the models. VIATRA was already successfully applied to complex domains such as UML or AutoSAR and handled models up to millions of model elements. To achieve this kind of scalability, it is possible to configure the execution in detail, including the selection of the algorithm used by the model queries.

The queries and transformation available in the CPS demonstrator are also used to benchmark the capabilities of the framework. The benchmark code is available and is executed regularly to detect performance regressions during development.

To learn more about the VIATRA framework, we suggest having a look at the comprehensive documentation of the project, especially the getting started tutorial.

What’s new in VIATRA 2.0?

Eclipse Photon will include version 2.0 of the VIATRA framework. The main goals of the new release were to both simplify and modernize the existing code of the project.

One aspect of this modernization was to require Java 8 as a minimum dependency, allowing features such as lazily calculated query results via a stream-friendly API. Naturally, it was also seen to that everything works with Java 9 and 10 as well.

Listing 2: Processing the results of the query using the new Stream API

The query language was also enhanced with a few new features that makes pattern definitions simpler, e.g. by reducing the need for trivial patterns like ones enumerating all instances of a given class. In addition to these changes, version 2.0 includes fixes and performance optimizations to ensure VIATRA works as expected in as many environments and workloads as possible.

Of course the development of VIATRA will not stop after the release. In fact, the planning of VIATRA 2.1 has already begun. We plan to maintain our cadence of two new feature releases per year after Photon, so VIATRA 2.1 is planned for Eclipse 2018-12. With regards to planned features, work has begun on a graphical query editor using Sirius. This editor will provide an alternate way to create and review model queries while maintaining compatibility with the existing runtime.

Using VIATRA beyond EMF

Although VIATRA was originally designed for the needs of model-driven engineering tools based on the Eclipse Modeling Framework (EMF), the VIATRA core itself can be applied to other modeling or engineering tools. Version 2.0 introduces new API enhancements that make it easier to develop such model access connectors in additional, heterogeneous technological spaces.

Based on these capabilities, several open source and commercial adaptations have been developed, including the INCA tool that analyses software code created in IDEs including mbeddr. Recently, VIATRA 2.0 was also successfully integrated with MagicDraw and Teamwork Cloud, a popular commercial UML/SysML modeling and collaboration platform. Some aspects of this integration have been released as open source (V4MD), while others empower commercial products aimed at scalable cloud-based modeling (IncQuery for MagicDraw and the IncQuery Server). To learn more about these developments, check out our EclipseCon France 2018 presentation.

Links

About the Authors

Zoltan Ujhelyi

Zoltán Ujhelyi
IncQuery Labs

Gabor Bergmann

Gábor Bergmann
IncQuery Labs