| <html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.1.4. Graph Pattern Call</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. Pattern Definition"><link rel="prev" href="def_NegativePattern.html" title="2.1.3. Negative Pattern"><link rel="next" href="def_PatternComposition.html" title="2.1.5. Pattern Composition"></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.4. Graph Pattern Call</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="def_NegativePattern.html">Prev</a> </td><th align="center" width="60%">2.1. Pattern Definition</th><td align="right" width="20%"> <a accesskey="n" href="def_PatternComposition.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_GraphPatternCall"></a>2.1.4. Graph Pattern Call</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_GraphPatternCall_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p> | |
| A | |
| <span class="strong"><strong>graph pattern call</strong></span> | |
| <a name="N10525" class="indexterm"></a> | |
| from an ASM rule initiates graph pattern matching. | |
| </p><p> | |
| A | |
| <span class="strong"><strong>graph pattern call</strong></span> | |
| <a name="N10530" class="indexterm"></a> | |
| can be initiated in the following contexts: | |
| </p><div class="orderedlist"><ol type="1"><li><p> | |
| in ASM part by a | |
| <a href="def_ChooseRule.html" title="4.3.6. Choose Rule">choose rule</a> | |
| or | |
| <a href="def_ForallRule.html" title="4.3.7. Forall Rule">forall rule</a> | |
| </p></li><li><p> | |
| where | |
| <a href="def_LogicalTerm.html" title="5.2.1. Logical Term">base logical term</a> | |
| can be used (e.g. in <a href="def_IfRule.html" title="4.3.9. If Rule">if rule</a>). | |
| </p></li></ol></div></td></tr></table></div><pre class="programlisting"> | |
| GraphPatternCallAST ::= <span class="token">find</span> <a href="def_ModelElementName.html" title="5.7.1. Model Element Name">QualifiedTypeNameAST</a> <a href="def_ActualParameter.html" title="5.8.3. Actual Parameters">ActualParameterDefAST</a> | |
| ActualParameterDefAST ::= <span class="token">(</span> <a href="def_ActualParameter.html" title="5.8.3. Actual Parameters">ActualParamsAST</a> <span class="token">)</span> | |
| | <span class="token">(</span> <span class="token">)</span> | |
| </pre><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_GraphPatternCall_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><p> | |
| The called graph pattern is identified by the | |
| <span class="strong"><strong>graph pattern name</strong></span> | |
| <a name="N10576" class="indexterm"></a> | |
| and its | |
| <span class="strong"><strong>arity</strong></span> | |
| <a name="N1057F" class="indexterm"></a> | |
| (number of parameters). | |
| </p><p>A local name of the called graph pattern can be used if</p><div class="itemizedlist"><ul type="disc"><li><p>it is defined in the same machine or</p></li><li><p> | |
| it is defined in another machine but the namespace of the pattern is imported at the beginning of | |
| the file. | |
| </p></li></ul></div><p> | |
| If the pattern is defined in another machine and its namespace is not imported then the | |
| <span class="strong"><strong>graph pattern name</strong></span> | |
| <a name="N10593" class="indexterm"></a> | |
| should be the | |
| <a href="def_ModelElementName.html" title="5.7.1. Model Element Name">fully qualified name</a> of the pattern. | |
| </p><p> | |
| The | |
| <a href="def_ActualParameter.html" title="5.8.3. Actual Parameters">actual params</a> | |
| part is the list of actual parameters supplied to the called graph pattern. | |
| </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_GraphPatternCall_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p> | |
| 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. | |
| </p><div class="itemizedlist"><ul type="disc"><li><p> | |
| If an actual parameter is bound then it is an | |
| <span class="emphasis"><em>input parameter</em></span> | |
| for pattern matching. The binding of all input parameters is kept unchanged during pattern matching. | |
| </p></li><li><p> | |
| If an actual parameter is unbound then it is an | |
| <span class="emphasis"><em>output parameter</em></span>, | |
| and a binding is calculated during pattern matching. | |
| </p></li></ul></div><p> | |
| If the matching of a called pattern fails, then it still depends on the caller ASM rule if this failure is | |
| propagated or not. | |
| </p><div class="itemizedlist"><ul type="disc"><li><p> | |
| In case of <a href="def_ForallRule.html" title="4.3.7. Forall Rule">forall rule</a>, | |
| execution continues if no matches are found for the called pattern. | |
| </p></li><li><p> | |
| In case of | |
| <a href="def_ChooseRule.html" title="4.3.6. Choose Rule">choose rule</a>, execution fails, and backtracking is initiated as in case of | |
| <a href="def_FailRule.html" title="4.2.4. Fail Rule">fail rule</a> | |
| . | |
| </p></li></ul></div><p> | |
| Containment constraints of quantified variables defined in a | |
| <a href="def_ForallRule.html" title="4.3.7. Forall Rule">forall rule</a> or a | |
| <a href="def_ChooseRule.html" title="4.3.6. Choose Rule">choose rule</a> | |
| are passed to the pattern matching engine as additional containment constraints. | |
| </p><p> | |
| When pattern matching is initiated from a | |
| <a href="def_LogicalTerm.html" title="5.2.1. Logical Term">base logical term</a>, | |
| successful pattern matching is converted to the logical | |
| <span class="emphasis"><em>true</em></span> | |
| value while the failure of pattern matching is interpreted as the logical | |
| <span class="emphasis"><em>false</em></span> | |
| 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 | |
| <a href="def_LogicalTerm.html" title="5.2.1. Logical Term">base logical term</a>. | |
| </p></td></tr></table></div><div class="highlights"><a name="def_GraphPatternCall_UsedBy"></a><p><b>Used By: </b> | |
| <a href="def_GTRuleDef.html" title="3.1.1. Graph Transformation Rule Definition">GT rule definition</a>, | |
| <a href="def_PatternBody.html" title="2.1.2. Pattern Body">pattern body</a>, | |
| <a href="def_NegativePattern.html" title="2.1.3. Negative Pattern">negative pattern</a>, | |
| <a href="def_LogicalTerm.html" title="5.2.1. Logical Term">base logical term</a> | |
| </p></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="def_NegativePattern.html">Prev</a> </td><td align="center" width="20%"><a accesskey="u" href="sec_PatternDefinition.html">Up</a></td><td align="right" width="40%"> <a accesskey="n" href="def_PatternComposition.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">2.1.3. Negative Pattern </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> 2.1.5. Pattern Composition</td></tr></table></div></body></html> |