blob: 6ff8d5fe99a198b646c71edfbec0c9e8bbf361ff [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3.4.1.&nbsp;GTRule 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_InvokeGTRule.html" title="3.4.&nbsp;Invocation of Graph Transformation Rules"><link rel="prev" href="sec_InvokeGTRule.html" title="3.4.&nbsp;Invocation of Graph Transformation Rules"><link rel="next" href="sec_ASMRules.html" title="4.&nbsp;ASM Rules"></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">3.4.1.&nbsp;GTRule Call</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="sec_InvokeGTRule.html">Prev</a>&nbsp;</td><th align="center" width="60%">3.4.&nbsp;Invocation of Graph Transformation Rules</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="sec_ASMRules.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_GTRuleCall"></a>3.4.1.&nbsp;GTRule 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_GTRuleCall_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
Graph transformation rules can be invoked to execute model manipulation by
using the <a href="def_ChooseRule.html" title="4.3.6.&nbsp;Choose Rule">choose rule</a>or <a href="def_ForallRule.html" title="4.3.7.&nbsp;Forall Rule">forall rule</a>to apply
the GT rule for a single match or for all matches, respectively.
</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_GTRuleCall_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
GTRuleCallAST ::= <span class="token">apply</span> <a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">QualifiedTypeNameAST</a> <a href="def_ActualParameter.html" title="5.8.3.&nbsp;Actual Parameters">ActualParameterDefAST</a>
ActualParameterDefAST ::= <span class="token">(</span> <a href="def_ActualParameter.html" title="5.8.3.&nbsp;Actual Parameters">ActualParamsAST</a> <span class="token">)</span>
| <span class="token">(</span> <span class="token">)</span>
</pre><p>
The rule is identified by the <span class="strong"><strong>GT rule name</strong></span><a name="N11099" class="indexterm"></a>. It can be the local
<a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">name</a>of the rule if
</p><div class="itemizedlist"><ul type="disc"><li><p>the rule is defined in the same file or</p></li><li><p>
the rule is defined in another file but the namespace of the rule is imported at the beginning of the
file.
</p></li></ul></div><p>
If the rule is defined in another file and its <a href="def_NamespaceImport.html" title="1.1.3.&nbsp;Namespace Import">namespace</a> is not imported
then the <span class="strong"><strong>GT rule name</strong></span> should be the <a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">fully qualified name</a> of
the rule.
</p><p>
The <a href="def_ActualParameter.html" title="5.8.3.&nbsp;Actual Parameters">actual parameter</a> part is the list of actual parameters.
</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_GTRuleCall_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
In general, during the execution of a rule variables are bound according to
the LHS (precondition or condition part) of the rule and model manipulation
is performed according to the RHS (postcondition or condition part) and the
action parts.
</p><p>
In more details, during the execution of a rule
</p><div class="orderedlist"><ol type="1"><li><p>all matchings determined by LHS are collected,</p></li><li><p>for each matching in a single step the followings are executed in the specified order:</p><div class="orderedlist"><ol type="a"><li><p>
model manipulation determined by the RHS of the GT rule (which is defined by either the
postcondition or the condition part),
</p></li><li><p>action part of the GT rule,</p></li><li><p>
do part of the
<a href="def_ChooseRule.html" title="4.3.6.&nbsp;Choose Rule">choose rule</a>
or
<a href="def_ForallRule.html" title="4.3.7.&nbsp;Forall Rule">forall rule</a>.
</p></li></ol></div></li></ol></div></td></tr></table></div><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution: Constraints"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left"><a name="def_GTRuleCall_Constraints"></a>Constraints</th></tr><tr><td valign="top" align="left"><p>
Input-only parameters of the rule - i.e. the parameters that are tagged with
in the formal definition of the parameter list - can be an arbitrary ASM <a href="def_Term.html" title="5.1.1.&nbsp;ASM Term">term</a>,
but output parameters must be variables.
</p><p>
All variables used in the <a href="def_ActualParameter.html" title="5.8.3.&nbsp;Actual Parameters">actual parameters</a> part have to be
already defined before the invocation of the rule, although these can be unbound.
</p></td></tr></table></div><div class="highlights"><a name="def_GTRuleCall_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 class="highlights"><a name="def_GTRuleCall_SeeAlso"></a><p><b>See Also:&nbsp;</b>
<a href="def_NamespaceDefinition.html" title="1.1.2.&nbsp;Namespace Definition">Namespace definition</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_InvokeGTRule.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="sec_InvokeGTRule.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="sec_ASMRules.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">3.4.&nbsp;Invocation of Graph Transformation Rules&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%">&nbsp;4.&nbsp;ASM Rules</td></tr></table></div></body></html>