![]() | Description |
---|---|
Pattern composition enables the reusability of graph patterns by allowing to combine elementary graph patterns into complex patterns in a declarative way. Pattern composition can be initiated in the following contexts:
|
![]() | Syntax |
---|---|
PatternCompositionAST ::= find QualifiedTypeNameAST ActualPatternParameterDefAST ActualPatternParameterDefAST ::= ( ActualParamsPatternVariablesAST ) | ( ) The syntax of pattern composition is formally identical to the syntax of a graph pattern call. However, a main restriction is that only pattern variables may appear as actual parameters in a pattern composition, and not arbitrary terms as in case of graph pattern call. |
![]() | Semantics |
---|---|
The semantics of called graph patterns differs on the context in which the pattern call is initiated.
As in case of graph pattern call, the variables in the actual parameter list supplied to the called graph pattern from the caller pattern can be either bound or unbound.
In case of pattern composition , each actual parameter is required to be a pattern variable (with respective semantics) instead of arbitrary ASM term as in case of graph pattern calls. As a general rule (i.e. in case of positive pattern composition), if the matching of a subpattern fails, then the matching of the entire pattern also fails. However, if the subpattern is a negative pattern, then the success of the caller is reversed, i.e. if the subpattern fails, then the caller succeeds, and vice versa. Pattern composition can also be recursive, i.e. a pattern may call itself as a subpattern in one or more pattern bodies. Recursion is evaluated by bottom-up fixpoint calculation. It is worth pointing out that a very general interpretation is allowed in VTCL: the only structural restriction is that recursion in positive and negative patterns are not allowed to interfere, i.e. if a pattern is called recursively in a negative pattern, than it is not allowed to be called recursively in the positive pattern, and vice versa. Note that this restriction only applies to recursive pattern composition calls. |
See also: Graph pattern call,