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.
Difference between revisions of "VIATRA/Transformation/Transformation API"
< VIATRA | Transformation
(New page: = VIATRA2 EMF Transformation API = * Based on EVM * Relies on Xtend features such as extension methods and closures to be * [[VIATRA2...) |
|||
Line 13: | Line 13: | ||
* ModelManipulation - generic model manipulation primitives; hides details of EditingDomains (if necessary); implementation not batch transformation specific | * ModelManipulation - generic model manipulation primitives; hides details of EditingDomains (if necessary); implementation not batch transformation specific | ||
+ | === Batch Transformation Rules === | ||
+ | |||
+ | * Special rule type | ||
+ | ** Precondition + action | ||
+ | ** Life cycle: | ||
+ | *** Stateless | ||
+ | **** rule does not maintain state whether an activation has fired or not | ||
+ | **** Lifecycle: firing: active -> active | ||
+ | *** Stateful | ||
+ | **** rule maintains whether an an activation has fired or not | ||
+ | **** Lifecycle: firing: active -> fired | ||
=== (Batch) Transformation Statements === | === (Batch) Transformation Statements === | ||
Revision as of 05:50, 16 September 2013
Contents
VIATRA2 EMF Transformation API
- Based on EVM
- Relies on Xtend features such as extension methods and closures to be
- Language concepts (for requirements overview)
- Documentation for API in org.eclipse.viatra2.emf.git (browse, stats, fork on OrionHub)
Batch Transformation API
Three extension classes used for transformations:
- BatchTransformation - hides IncQueryEngine and RuleEngine; manages group initialization of rules - instead of an extension method, this can also be used as a base class
- TransformationStatements - control structure
- ModelManipulation - generic model manipulation primitives; hides details of EditingDomains (if necessary); implementation not batch transformation specific
Batch Transformation Rules
- Special rule type
- Precondition + action
- Life cycle:
- Stateless
- rule does not maintain state whether an activation has fired or not
- Lifecycle: firing: active -> active
- Stateful
- rule maintains whether an an activation has fired or not
- Lifecycle: firing: active -> fired
- Stateless
(Batch) Transformation Statements
Name | Parameters | Description |
---|---|---|
choose | Batch Transformation Rule, (opt: filter) | Fires a single activation |
forall | Batch Transformation Rule, (opt: filter) | Fires all current activations. If the firings change the set of activations, it won't change the set of fired activations. |
until | Batch Transformation Rule, break condition, (opt: filter) | After firing the first activation, it checks whether the break condition became true; if yes, exits, if not, it restarts. It does not store the initial set of activations. Useful for iterate-choose scenarios. |
Incremental Transformation API
TBA
Model Manipulation Primitives
To be implemented
Name | Parameters | Description |
---|---|---|
create EObject | Resource; EClass | Creates an object with the corresponding EClass type, and puts it into the root of the selected resource |
create EObject | EObject (container); EReference; EClass | Creates an object with the corresponding EClass type, and puts it into the selected reference; the reference must be of containment type |
add EObject | EObject (container); EReference; EObject | Adds an existing object to the corresponding container with a reference; the reference must *not* be of containment type |
add value | EObject (container); EAttribute; Object | Adds a value to the selected attribute of the container |
remove EObject | EObject | Removes the EObject from the model |
remove EObject | EObject (container); EReference; EObject | Removes an object from the selected container; if reference is containment, also removes it from the resource set |
move | TBA | TBA |