blob: b8c0bade817a57b2838291e594c69a43e5be561d [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.1.1.&nbsp;Graph Pattern Definition</title><link href="style.css" rel="stylesheet" type="text/css"><meta content="DocBook XSL Stylesheets V1.72.0" name="generator"><link rel="start" href="index.html" title="The VIATRA2 Model Transformation Framework"><link rel="up" href="sec_PatternDefinition.html" title="2.1.&nbsp;Pattern Definition"><link rel="prev" href="sec_PatternDefinition.html" title="2.1.&nbsp;Pattern Definition"><link rel="next" href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">2.1.1.&nbsp;Graph Pattern Definition</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="sec_PatternDefinition.html">Prev</a>&nbsp;</td><th align="center" width="60%">2.1.&nbsp;Pattern Definition</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="def_PatternBody.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_GraphPatternDef"></a>2.1.1.&nbsp;Graph Pattern Definition</h4></div></div></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip: Description"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left"><a name="def_GraphPatternDef_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
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.
</p><p>
Graph patterns can be either
<span class="emphasis"><em>predefined</em></span>
in the context of a
<a href="def_Machine.html" title="1.2.1.&nbsp;GTASM Machine Definition">GTASM machine</a>
or defined locally as part of a graph transformation rule
<a href="def_GTRuleDef.html" title="3.1.1.&nbsp;Graph Transformation Rule Definition">GT rule</a>
or as part of a negative pattern
<a href="def_NegativePattern.html" title="2.1.3.&nbsp;Negative Pattern">negative pattern</a>
in the body of another pattern.
</p></td></tr></table></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Syntax"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left"><a name="def_GraphPatternDef_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
GraphPatternDefAST ::= <a href="def_Annotation.html" title="1.2.2.&nbsp;Annotation">OptAnnotationsAST</a> <span class="token">pattern</span> <a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">TypeNameAST</a> <a href="def_FormalParameter.html" title="5.8.1.&nbsp;Formal Parameters">FormalParameterDefAST</a> <span class="token">=</span> <a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">PatternBodiesAST</a>
FormalParameterDefAST ::= <span class="token">(</span> <a href="def_FormalParameter.html" title="5.8.1.&nbsp;Formal Parameters">FormalParamsAST</a> <span class="token">)</span>
| <span class="token">(</span> <span class="token">)</span>
</pre><p>
<a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">name</a>
is the identifier of the pattern.
</p><p>
The list of
<a href="def_FormalParameter.html" title="5.8.1.&nbsp;Formal Parameters">formal parameters</a>
in graph patterns are different from that of ASM rules in the sense that the parameters of a graph pattern
do not have directions (<code class="computeroutput">in</code>,
<code class="computeroutput">out</code>,
<code class="computeroutput">inout</code>).
</p><p>
A graph pattern definition consists of at least one
<a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">pattern body</a>
definition. If multiple bodies are present, there is an OR condition between them.
</p></td></tr></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note: Semantics"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left"><a name="def_GraphPatternDef_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
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.
</p><p>
As graph pattern matching is initiated in an ASM program by a
<a href="def_ChooseRule.html" title="4.3.6.&nbsp;Choose Rule">choose rule</a>
<a name="N10351" class="indexterm"></a>
or
<a href="def_ForallRule.html" title="4.3.7.&nbsp;Forall Rule">forall rule</a>
<a name="N1035A" class="indexterm"></a>, 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.
</p><p>
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.
</p><p>
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
<a href="def_PatternVariableAssignment.html" title="2.1.7.&nbsp;Pattern Variable Assignment">pattern variable assignment</a>).
</p><p>
If multiple bodies are present (OR-pattern) the pattern is considered to be matched if at least one of the
bodies can be matched.
</p></td></tr></table></div><div class="highlights"><a name="def_GraphPatternDef_DefinedIn"></a><p><b>Defined In:&nbsp;</b>
<a href="def_Machine.html" title="1.2.1.&nbsp;GTASM Machine Definition">GTASM machine</a>,
<a href="def_GTRuleDef.html" title="3.1.1.&nbsp;Graph Transformation Rule Definition">GT rule definition</a> ,
<a href="def_NegativePattern.html" title="2.1.3.&nbsp;Negative Pattern">negative pattern</a>
</p></div><div class="highlights"><a name="def_GraphPatternDef_UsedBy"></a><p><b>Used By:&nbsp;</b>
<a href="def_ChooseRule.html" title="4.3.6.&nbsp;Choose Rule">Choose rule</a>,
<a href="def_ForallRule.html" title="4.3.7.&nbsp;Forall Rule">Forall rule</a>,
</p></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="sec_PatternDefinition.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="sec_PatternDefinition.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="def_PatternBody.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">2.1.&nbsp;Pattern Definition&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%">&nbsp;2.1.2.&nbsp;Pattern Body</td></tr></table></div></body></html>