blob: f645ba3353e624416a337e2fbf72f63baeac89d2 [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.2.3.&nbsp;Relationships</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_LocalPatternlElementDescription.html" title="2.2.&nbsp;Local Pattern Body Elements"><link rel="prev" href="def_Relation.html" title="2.2.2.&nbsp;Relation"><link rel="next" href="sec_GraphTransformations.html" title="3.&nbsp;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">2.2.3.&nbsp;Relationships</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="def_Relation.html">Prev</a>&nbsp;</td><th align="center" width="60%">2.2.&nbsp;Local Pattern Body Elements</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="sec_GraphTransformations.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_Relationship"></a>2.2.3.&nbsp;Relationships</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_Relationship_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
A relationship is a special relation that is model independent and is defined as part of the VPM. It
describes either inheritance (i.e. supertype-subtype) or instantiation (i.e. type-instance) relation.
</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_Relationship_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
RelationshipAST ::= InheritanceAST | InstantiationAST
InheritanceAST ::= <span class="token">supertypeOf</span> RelationshipBodyAST
| <span class="token">subtypeOf</span> RelationshipBodyAST
InstantiationAST ::= <span class="token">typeOf</span> RelationshipBodyAST
| <span class="token">instanceOf</span> RelationshipBodyAST
RelationshipBodyAST ::= <span class="token">(</span> <a href="def_PatternVariable.html" title="2.1.6.&nbsp;Pattern Variable">PatternVariableRefAST</a> <span class="token">,</span> <a href="def_PatternVariable.html" title="2.1.6.&nbsp;Pattern Variable">PatternVariableRefAST</a> <span class="token">)</span>
</pre><p>
A <span class="strong"><strong>relationship</strong></span>
<a name="N10B74" class="indexterm"></a>
is either an
<span class="strong"><strong>inheritance</strong></span>
<a name="N10B7D" class="indexterm"></a>
or an
<span class="strong"><strong>instantiation</strong></span>
<a name="N10B88" class="indexterm"></a>.
</p><p>
In each case two model element is referenced by pattern variables references: a
<a href="def_PatternVariable.html" title="2.1.6.&nbsp;Pattern Variable">parent reference</a>, and a
<a href="def_PatternVariable.html" title="2.1.6.&nbsp;Pattern Variable">child reference</a>.
</p><p>
In case of <span class="strong"><strong>inheritance</strong></span>
the parent is the <span class="emphasis"><em>supertype</em></span>
and the child is the <span class="emphasis"><em>subtype</em></span>.
</p><p>
In case of <span class="strong"><strong>instantiation</strong></span>
the parent is the <span class="emphasis"><em>type</em></span>
and the child is the <span class="emphasis"><em>instance</em></span>.
</p><p>In case of both relationships both the parent and the child can be an entity or a relation.</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_Relationship_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
The description of a <span class="strong"><strong>relationship</strong></span>
can appear in the context of a <a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">pattern body</a>.
It either references an existing relationship if it is used in pattern matching or defines a new
relationship.
</p><p>
In case of <span class="strong"><strong>inheritance</strong></span>
both and refers to the same relationship; only the order of the parameters are different.
</p><p>
In case of <span class="strong"><strong>instantiation</strong></span>
both and refers to the same relationship; only the order of the parameters are different.
</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_Relationship_Constraints"></a>Constraints</th></tr><tr><td valign="top" align="left"><p>
The parent and the child of the relationships must refer to the same type of model element, i.e. either both
refer to entities or both refer to relations.
</p></td></tr></table></div><div class="highlights"><a name="def_Relationship_DefinedIn"></a><p><b>Defined In:&nbsp;</b>
<a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">local pattern body element</a>
</p></div><div class="highlights"><a name="def_Relationship_UsedBy"></a><p><b>Used By:&nbsp;</b>
<a href="def_CreateRule.html" title="4.4.2.&nbsp;Create Rule">create rule</a>,
<a href="def_DeleteRule.html" title="4.4.3.&nbsp;Delete Rule">delete rule</a>
</p></div><div class="highlights"><a name="def_Relationship_SeeAlso"></a><p><b>See Also:&nbsp;</b>
<a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">pattern body</a>,
<a href="def_Entity.html" title="2.2.1.&nbsp;Entity">entity</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_Relation.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="sec_LocalPatternlElementDescription.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="sec_GraphTransformations.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">2.2.2.&nbsp;Relation&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.&nbsp;Graph Transformation Rules</td></tr></table></div></body></html>