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
- Xtend (`id = batch.simple`)
- Xtend + EMF-IncQuery (`id = batch.eiq`)
- 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")
- Direct notification (`id = incr.direct`)
- dirty: EMF adapter/IQBase
- Explicit traceability (`id = incr.expl`)
- dirty: traceability model state
- Details at https://github.com/IncQueryLabs/incquery-examples-cps/wiki/Explicit-traceability-M2M-transformation
- Query result traceability (`id = incr.qrt`)
- dirty: query result bookmarking, traceability saved in deltamonitor
- Details at https://github.com/IncQueryLabs/incquery-examples-cps/wiki/Query-result-traceability-M2M-transformation
- Partial batch transformation (`id = incr.aggr`)
- dirty: consider query results as notifications/events, low level change aggregation (transform bigger parts)
- advanced: notifications independent of source model, transformation may run in background
- Details at https://github.com/IncQueryLabs/incquery-examples-cps/wiki/Partial-batch-M2M-transformation
- Change-driven transformations (`id = incr.cdt`)
- dirty: EVM activation life-cycle
- VIATRA event-driven transformation API (`id = incr.viatra`)
The CPS example is being migrated into eclipse.org, tracked at bug 490621.
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).
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.
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.
- Case description: http://planet-sl.org/community/index.php?option=com_community&view=groups&task=viewgroup&groupid=26&Itemid=387&lang=en
- Implementation: https://github.com/izsob/TTC13-PN2SC-EIQ (look for the branch viatra-api)
- The following snippets are taken from this repository
Program understanding (Java code to state charts)
The most up-to-date example can be found here: https://github.com/ujhelyiz/viatra2-programunderstanding
Petri net simulator
A very simple, batch transformation program is available from here: https://github.com/ujhelyiz/viatra-petrinet-simulator