3.4.1. GTRule Call

[Tip]Description

Graph transformation rules can be invoked to execute model manipulation by using the choose ruleor forall ruleto apply the GT rule for a single match or for all matches, respectively.

[Important]Syntax
GTRuleCallAST ::= apply QualifiedTypeNameAST ActualParameterDefAST
ActualParameterDefAST ::= ( ActualParamsAST ) 
                        | ( ) 

The rule is identified by the GT rule name. It can be the local nameof the rule if

  • the rule is defined in the same file or

  • the rule is defined in another file but the namespace of the rule is imported at the beginning of the file.

If the rule is defined in another file and its namespace is not imported then the GT rule name should be the fully qualified name of the rule.

The actual parameter part is the list of actual parameters.

[Note]Semantics

In general, during the execution of a rule variables are bound according to the LHS (precondition or condition part) of the rule and model manipulation is performed according to the RHS (postcondition or condition part) and the action parts.

In more details, during the execution of a rule

  1. all matchings determined by LHS are collected,

  2. for each matching in a single step the followings are executed in the specified order:

    1. model manipulation determined by the RHS of the GT rule (which is defined by either the postcondition or the condition part),

    2. action part of the GT rule,

    3. do part of the choose rule or forall rule.

[Caution]Constraints

Input-only parameters of the rule - i.e. the parameters that are tagged with in the formal definition of the parameter list - can be an arbitrary ASM term, but output parameters must be variables.

All variables used in the actual parameters part have to be already defined before the invocation of the rule, although these can be unbound.

Used By:  choose rule, forall rule

See Also:  Namespace definition