Jump to: navigation, search

VIATRA/Transformation/Examples

The CPS Demonstrator example

As a main demonstrating example, the CPS demonstrator provides a complex set of VIATRA features over the Cyber-physical Systems domain. In addition to model transformation and code generation support, the demonstrator also presents live validation, query-based viewers, query-driven derived features usage.

The model transformations themselves were implemented using Xtend, but different variants.

Batch Transformation Variants

  1. Xtend (`id = batch.simple`)
  2. Xtend + EMF-IncQuery (`id = batch.eiq`)
  3. VIATRA Batch API (`id = batch.viatra`)

Incremental Transformation Variants

For the incremental alternatives, a differentiating factor is the method to identify changes in the source model which must be synchronized to the target ("dirty flag")

  1. Direct notification (`id = incr.direct`)
    • dirty: EMF adapter/IQBase
  2. Explicit traceability (`id = incr.expl`)
  3. Query result traceability (`id = incr.qrt`)
  4. Partial batch transformation (`id = incr.aggr`)
  5. Change-driven transformations (`id = incr.cdt`)
    • dirty: EVM activation life-cycle
  6. VIATRA event-driven transformation API (`id = incr.viatra`)


The CPS example is being migrated into eclipse.org, tracked at bug 490621.

Other examples

Petri net simulator with Maven

A simple, Hello world transformation is available from http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git/tree/transformation that uses a pure maven-build (does not require Eclipse to be executed).


Older examples

The following examples were created for earlier versions of VIATRA; they may or may not work ported to the current version of VIATRA; and while they illustrate basic usage of the framework, might require adjusting to work with current versions.

Java Refactoring

An example transformation is available for the Java Refactoring case of the Transformation Tool Contest 2015

Movie Database

An example transformation is available for the Movie Database case of the Transformation Tool Contest 2014 (plain Xtend transformation over EMF-IncQuery API; does not rely on EVM or transformation API)

Petri nets to State charts

An example transformation is available by implementing the Petri net to State Charts case of the Transformation Tool Contest 2013.

Program understanding (Java code to state charts)

A partial implementation of the Program Understanding case of TTC 2011 can be found here: https://github.com/ujhelyiz/viatra-programunderstanding

Petri net simulator

A very simple, batch transformation program is available from here: https://github.com/ujhelyiz/viatra-petrinet-simulator