2.1.4. Graph Pattern Call

[Tip]Description

A graph pattern call from an ASM rule initiates graph pattern matching.

A graph pattern call can be initiated in the following contexts:

  1. in ASM part by a choose rule or forall rule

  2. where base logical term can be used (e.g. in if rule).

GraphPatternCallAST ::= find QualifiedTypeNameAST ActualParameterDefAST
ActualParameterDefAST ::= ( ActualParamsAST ) 
                        | ( ) 
[Important]Syntax

The called graph pattern is identified by the graph pattern name and its arity (number of parameters).

A local name of the called graph pattern can be used if

  • it is defined in the same machine or

  • it is defined in another machine but the namespace of the pattern is imported at the beginning of the file.

If the pattern is defined in another machine and its namespace is not imported then the graph pattern name should be the fully qualified name of the pattern.

The actual params part is the list of actual parameters supplied to the called graph pattern.

[Note]Semantics

The variables in the actual parameter list supplied to the called graph pattern from the caller ASM context can be either bound or unbound. This way, the semantics of a graph pattern call depends on its adornment, i.e. the binding of actual parameters.

  • If an actual parameter is bound then it is an input parameter for pattern matching. The binding of all input parameters is kept unchanged during pattern matching.

  • If an actual parameter is unbound then it is an output parameter, and a binding is calculated during pattern matching.

If the matching of a called pattern fails, then it still depends on the caller ASM rule if this failure is propagated or not.

  • In case of forall rule, execution continues if no matches are found for the called pattern.

  • In case of choose rule, execution fails, and backtracking is initiated as in case of fail rule .

Containment constraints of quantified variables defined in a forall rule or a choose rule are passed to the pattern matching engine as additional containment constraints.

When pattern matching is initiated from a base logical term, successful pattern matching is converted to the logical true value while the failure of pattern matching is interpreted as the logical false value. Note, however, even if the matching of the called pattern succeeds, the actual bindings are forbidden to be used (i.e. thrown away) in the context of caller base logical term.

Used By:  GT rule definition, pattern body, negative pattern, base logical term