blob: c984690209c9e1c41f8143bbc31b2511c1250995 [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.1.9.&nbsp;Containment Constraint</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="def_CheckCondition.html" title="2.1.8.&nbsp;Check Condition"><link rel="next" href="sec_LocalPatternlElementDescription.html" title="2.2.&nbsp;Local Pattern Body Elements"></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.9.&nbsp;Containment Constraint</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="def_CheckCondition.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="sec_LocalPatternlElementDescription.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_ContainmentConstraint"></a>2.1.9.&nbsp;Containment Constraint</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_ContainmentConstraint_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
A <span class="strong"><strong>containment constraint</strong></span>
<a name="N108B7" class="indexterm"></a>
is defined in the scope of a variable. It restricts the domain of a
variable with respect to the containment hierarchy of the model space.
</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_ContainmentConstraint_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
ContainmentConstraintOptAST ::= $empty
| <span class="token">in</span> <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">ArithmeticTermAST</a>
| <span class="token">below</span> <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">ArithmeticTermAST</a>
</pre><p>
The <span class="strong"><strong>container</strong></span><a name="N108D6" class="indexterm"></a> in a
<span class="strong"><strong>containment constraint</strong></span> is an
<a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">arithmetic term</a> which evaluates to an entity.
</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_ContainmentConstraint_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
In case of the <code class="computeroutput">in</code> constraint, the domain of the constrained variable
is restricted to the elements that are directly contained by the
<span class="strong"><strong>container</strong></span>, i.e. the domain contains the children of the
entity defined by the <span class="strong"><strong>container</strong></span>.
</p><p>
In case of the <code class="computeroutput">below</code> constraint the domain of the constrained variable
is restricted to the elements that are directly or indirectly contained by a
<span class="strong"><strong>container</strong></span>, i.e. the domain contains all the descendants
of the <span class="strong"><strong>container</strong></span> (e.g. the children, the
children of the children, etc. in an arbitrary depth).
</p></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_ContainmentConstraint_Constraints"></a>Constraints</th></tr><tr><td valign="top" align="left"><p>
A containment constraint can be applied only for variables that refer to
entities, but it is a run-time error if the scope of the containment constraint is a relation.
</p></td></tr></table></div><div class="highlights"><a name="def_ContainmentConstraint_UsedBy"></a><p><b>Used By:&nbsp;</b>
<a href="def_ConstrainedVariableList.html" title="5.8.4.&nbsp;Constrained Variable List">constrained variable list</a>,
<a href="def_Entity.html" title="2.2.1.&nbsp;Entity">entity</a>
</p></div><div class="highlights"><a name="def_ContainmentConstraint_SeeAlso"></a><p><b>See Also:&nbsp;</b>
<a href="def_Variable.html" title="5.7.2.&nbsp;Variable">variable</a>
<a href="def_PatternVariable.html" title="2.1.6.&nbsp;Pattern Variable">pattern variable</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_CheckCondition.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="sec_LocalPatternlElementDescription.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">2.1.8.&nbsp;Check Condition&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.2.&nbsp;Local Pattern Body Elements</td></tr></table></div></body></html>