Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

VIATRA2/Live Transformations/TriggerASM

Outdated page

This page contains obsolete information about the VPM based VIATRA2 and preserved for archive purposes only.
The currently maintained wiki is available at

The following trigger shows another important property of the live transformation engine, the handling of the ASMfunctions. These can be considered as global variables, the values stored in them are preserved throughout the triggers lifecycle.

machine HelloTriggerWorld
  // Beware, this is a global variable, which _holds_ it's value throughout the triggers lifecycle.
  asmfunction testFruit / 1
    ("fruit") = "apple"; // Startup value of the variable
  @Trigger(priority='100', mode='always', sensitivity='rise', startup='passive', execution='iterate')
  gtrule testTrigger(inout E) =
    // This pattern triggers the action sequence.
    precondition pattern lhs(E)=
    // The action sequence.
      println( "Trigger Action triggered by: " + E );
      println( "Trigger AsmTest: " + testFruit("fruit") );
      update testFruit("fruit") = "orange";
  //Main rule, the startTrigger() method invokes the engine.
  rule main() =
      println ( "VTCL AsmTest: " + testFruit("fruit") );
      println ( startTrigger("testTrigger") );

Back to the top