- 1 The CPS Demonstrator example
- 2 Other 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
- 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.
An example transformation is available for the Java Refactoring case of the Transformation Tool Contest 2015
- Case description: http://www.transformation-tool-contest.eu/2015/solutions_refactoring.html
- Paper: https://github.com/FTSRG/paper-ttc15-java-refactoring
- Implementation: https://github.com/viatra/java-refactoring-ttc-viatra
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)
- Case description: http://www.transformation-tool-contest.eu/2014/solutions_movie.html
- Paper: https://inf.mit.bme.hu/en/research/publications/movie-database-case-emf-incquery-solution
- Implementation: https://github.com/FTSRG/ttc14-eiq
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)
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