blob: 6bbf974f9176bcea8e7a1712f134d247fe948c97 [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3.2.&nbsp;Parameter passing at Graph Transformation Rules</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_GraphTransformations.html" title="3.&nbsp;Graph Transformation Rules"><link rel="prev" href="def_GTRuleDef.html" title="3.1.1.&nbsp;Graph Transformation Rule Definition"><link rel="next" href="sec_GTRuleBehaviour.html" title="3.3.&nbsp;Behavioural Specification of Graph Transformation 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.2.&nbsp;Parameter passing at Graph Transformation Rules</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="def_GTRuleDef.html">Prev</a>&nbsp;</td><th align="center" width="60%">3.&nbsp;Graph Transformation Rules</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="sec_GTRuleBehaviour.html">Next</a></td></tr></table><hr></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sec_GTParamPass"></a>3.2.&nbsp;Parameter passing at Graph Transformation Rules</h3></div></div></div><p>
Information flow between graph transformation rules and their precondition and postcondition patterns is carried
out by parameter passing.
</p><p>
Like in case of ASM rules, formal parameters of graph transformation rules can be grouped into three categories.
Note that this categorization is independent from the fact whether a given parameter is bound or unbound when
applying a GT rule.
</p><div class="itemizedlist"><ul type="disc"><li><p>
<span class="emphasis"><em>in</em></span>: The values of
<span class="strong"><strong>input parameters</strong></span>
<a name="N10D39" class="indexterm"></a>
passed to a graph transformation rule will be restored after applying the rule, i.e. if a new value is
assigned to an input variable during the application of a GT rule, this value will no longer be visible
after rule application. Its typical usage is that an initial match of a GT rule is assigned this way.
</p><p>It is a run-time error if an input parameter is unbound when calling a GT rule.</p></li><li><p>
<span class="emphasis"><em>out</em></span>: The values of
<span class="strong"><strong>output parameters</strong></span>
<a name="N10D4C" class="indexterm"></a>
passed to a graph transformation rule will be ignored when initiating pattern matching for the
precondition pattern, i.e. these parameters are treated during pattern matching as if they were unbound.
However, these values are passed back to the caller environment to make the new values accessible.
</p></li><li><p>
<span class="emphasis"><em>inout</em></span>: The values of
<span class="strong"><strong>inout parameters</strong></span>
<a name="N10D5D" class="indexterm"></a>
of a graph transformation rule are passed to a graph pattern matching engine (as in case of
<span class="strong"><strong>input parameters</strong></span>), and they are also passed back to the caller environment
(as in case of <span class="strong"><strong>output parameters</strong></span>).
</p><p>It is a run-time error if an input parameter is unbound when calling a GT rule.</p></li></ul></div><p>
Note that this interpretation of input and output variables is a change from previous release, where input and
output parameters of a GT rule were interpreted after the pattern matching phase.
</p><p>
As illustrated by <a href="sec_GTParamPass.html#fig:VTCL_ParamRelations" title="Figure&nbsp;2.2.&nbsp;Relations of parameters of the parts of a GT rule">Figure&nbsp;2.2, &ldquo;Relations of parameters of the parts of a GT rule&rdquo;</a>, a parameter of a graph transformation rule can be used
(i) in the precondition pattern, (ii) in the postcondition pattern, or in the action part (or in any combination of these)
provided that they are listed in the parameter list(s) of the corresponding patterns. In case of the action part, all
parameters of the GT rule itself of the precondition and postcondition patterns can be used (i.e. all these
variables are part of an implicit parameter list of the action part).
</p><div class="figure"><a name="fig:VTCL_ParamRelations"></a><p class="title"><b>Figure&nbsp;2.2.&nbsp;Relations of parameters of the parts of a GT rule</b></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="images/others/ParamRelations.png" align="middle" width="500" alt="Relations of parameters of the parts of a GT rule"></div></div><p></p></div><br class="figure-break"><div class="itemizedlist"><ul type="disc"><li><p>
Bound parameters of the precondition pattern are called
<span class="emphasis"><em>input parameters of the precondition</em></span>,
while unbound parameters of the postcondition are called
<span class="emphasis"><em>output parameters of the precondition</em></span>.
Input parameters are either parameters of the precondition pattern,
or they are <span class="emphasis"><em>input</em></span>
or <span class="emphasis"><em>inout</em></span>
parameters of the GT rule itself.
</p></li><li><p>
Bound parameters of the postcondition pattern are called
<span class="emphasis"><em>input parameters of the postcondition</em></span>,
while unbound parameters of the postcondition are called
<span class="emphasis"><em>output parameters of the precondition</em></span>.
Input parameters are <span class="emphasis"><em>input</em></span> or <span class="emphasis"><em>inout</em></span>
parameters of the GT rule itself.
</p></li></ul></div><p>
In the rare case when values are assigned multiple times to the same output parameter, assignments in the
precondition pattern are overridden by assignments defined by the postcondition pattern, which, in turn, are
overridden by assignments in the action part.
</p></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="def_GTRuleDef.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="sec_GraphTransformations.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="sec_GTRuleBehaviour.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">3.1.1.&nbsp;Graph Transformation Rule 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;3.3.&nbsp;Behavioural Specification of Graph Transformation Rules</td></tr></table></div></body></html>