2.1.1. Graph Pattern Definition

[Tip]Description

A graph pattern is the primary means for querying the model space. Graph patterns provide a way for defining logic constraints for the model structure.

Graph patterns can be either predefined in the context of a GTASM machine or defined locally as part of a graph transformation rule GT rule or as part of a negative pattern negative pattern in the body of another pattern.

[Important]Syntax
GraphPatternDefAST ::= OptAnnotationsAST pattern TypeNameAST FormalParameterDefAST = PatternBodiesAST
FormalParameterDefAST ::= ( FormalParamsAST ) 
                        | ( ) 

name is the identifier of the pattern.

The list of formal parameters in graph patterns are different from that of ASM rules in the sense that the parameters of a graph pattern do not have directions (in, out, inout).

A graph pattern definition consists of at least one pattern body definition. If multiple bodies are present, there is an OR condition between them.

[Note]Semantics

A graph pattern can be interpreted as a predefined query evaluated over the model space. Formally (see Sec.~ ), the semantics of a graph pattern is defined as the set of all matches in the model space.

As graph pattern matching is initiated in an ASM program by a choose rule or forall rule , the calling environment may restrict the result set by (i) supplying input parameters, (ii) quantifying pattern variables existentially or universally, or (iii) setting containment constraints to (the domains of) pattern variables.

The direction (or adornment) of a pattern parameter is determined only at execution time when pattern matching is initiated for that pattern. In this way, the same pattern can be called with different settings for parameter directions at various parts of a VTCL program.

The pattern matching engine implements injective pattern matching, i.e. each pattern variable has to be bound to different elements in the model (with the single exception of pattern variable assignment).

If multiple bodies are present (OR-pattern) the pattern is considered to be matched if at least one of the bodies can be matched.

Defined In:  GTASM machine, GT rule definition , negative pattern

Used By:  Choose rule, Forall rule,