1.2.2. Annotation

[Tip]Description

An annotation allows the transformation designers to fine-tune runtime settings. Currently, only few runtime annotations are supported in VIATRA to select the appropriate pattern matching engine, and to switch between batch and live transformations.

[Important]Syntax
OptAnnotationsAST ::= $empty | AnnotationsAST
	
AnnotationsAST ::= AnnotationAST 
                 | AnnotationsAST AnnotationAST

AnnotationAST ::= AnnotationNameAST
                | AnnotationNameAST ( AnnotationBodyAST )
	
AnnotationBodyAST ::= KeyValuePairAST
                    | AnnotationBodyAST , KeyValuePairAST
	                 
KeyValuePairAST ::= TypeNameAST = TypeNameAST  
		        
AnnotationNameAST ::= AnnotationLiteral

An annotation has a name which is prefixed by @. It may have an optional body defined in the form of key-value pairs within parentheses. The keys and values are restricted well-formed local names, although they are not required to point to actual model elements (i.e. it is only a syntactic restriction).

[Note]Semantics

Currently, the VIATRA interpreter accepts three annotations.

  • incremental: this can be attached to graph pattern definitions, machines.

    In case of graph patterns, it prescribes that the annotated pattern and all dependent patterns accessed by pattern composition should be executed using the incremental pattern matcher engine.

    When a machine is annotated, it prescribes that all patterns defined in the machine should be executed by the incremental pattern matcher.

  • localsearch: this can be also attached to graph pattern definitions, machines. The effect of this annotation is same as above, except for selecting the local search based pattern matching engine.
  • trigger: this can be also attached to a GT rule, and it defines that the corresponding GT rule is interpreted as a trigger.

Remark.  Note that in most cases, the incremental pattern matcher engine has significantly better performance. However, the default annotation for a pattern is @localsearch.

Used By:  GT rule definition, graph pattern definition, machine