blob: 4c20ccae1dde1e083823e37052b2d69e249e3b72 [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.4.3.&nbsp;Delete Rule</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_ASMModelManipulationRules.html" title="4.4.&nbsp;Model Manipulation Rules"><link rel="prev" href="def_CreateRule.html" title="4.4.2.&nbsp;Create Rule"><link rel="next" href="def_CopyRule.html" title="4.4.4.&nbsp;Copy Rule"></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">4.4.3.&nbsp;Delete Rule</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="def_CreateRule.html">Prev</a>&nbsp;</td><th align="center" width="60%">4.4.&nbsp;Model Manipulation Rules</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="def_CopyRule.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_DeleteRule"></a>4.4.3.&nbsp;Delete Rule</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_DeleteRule_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
The <span class="strong"><strong>delete rule</strong></span><a name="N11C96" class="indexterm"></a>
removes a model element or a relationship from the model.
</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_DeleteRule_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
DeleteRuleAST ::= <span class="token">delete</span> <span class="token">(</span> <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">ArithmeticTermAST</a> DeleteSemanticsOptAST <span class="token">)</span> <span class="token">;</span>
| <span class="token">delete</span> <span class="token">(</span> DeleteRelationshipAST <span class="token">)</span> <span class="token">;</span>
DeleteSemanticsOptAST ::= $empty | <span class="token">,</span> DeleteSemanticsAST
DeleteSemanticsAST ::= <span class="token">delete_content</span> | <span class="token">move_content</span>
DeleteRelationshipAST ::= <span class="token">supertypeOf</span> TwoParametersAST
| <span class="token">subtypeOf</span> TwoParametersAST
| <span class="token">typeOf</span> TwoParametersAST
| <span class="token">instanceOf</span> TwoParametersAST
TwoParametersAST ::= <span class="token">(</span> <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">ArithmeticTermAST</a> <span class="token">,</span> <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">ArithmeticTermAST</a> <span class="token">)</span>
</pre><p>
The parameter of a <span class="strong"><strong>delete rule</strong></span> is either a <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">term</a>
that evaluates to a model element or a <a href="def_Relationship.html" title="2.2.3.&nbsp;Relationships">relationship</a>.
</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_DeleteRule_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
If a model element is to be deleted then all relations that have this element either
as source or as target are deleted implicitly, too.
</p><p>
If an entity is to be deleted then optionally the <span class="strong"><strong>delete semantics</strong></span>
<a name="N11CFE" class="indexterm"></a> can be defined:
<div class="itemizedlist"><ul type="disc"><li><p><code class="computeroutput">delete_content</code> means that both the referenced element and its
contained elements - if any - are deleted from the model. This behavior
corresponds to the view when the model is interpreted along its
<span class="emphasis"><em>containment hierarchy</em></span>: in each deletion operation the node with its
whole subtree is deleted with the corresponding edges. This is the default
behavior.
</p></li><li><p><code class="computeroutput">move_content</code> means that only the referenced element is
deleted and the contained elements - if any - remain in the model; the new
container for these is the container of the deleted element. This behavior
corresponds to the view when the model is interpreted as a <span class="emphasis"><em>graph</em></span>: in
each deletion operation only a single node is deleted with corresponding
edges.
</p></li></ul></div>
</p><p>
The interpreter ignores multiple deleting and continue. Multiple deleting
occurs for instance in the following example
</p><pre class="programlisting">
delete(A, delete_content);
delete(B, delete_content);
</pre><p>
if <code class="computeroutput">B</code> is contained by <code class="computeroutput">A</code>.
In this case the second delete rule is ignored.
</p><p>
During debugging, the interpreter informs the user about the ignored rule
execution. The interpreter will issue no further information in normal
execution mode.
</p></td></tr></table></div><div class="highlights"><a name="def_DeleteRule_DefinedIn"></a><p><b>Defined In:&nbsp;</b>
<a href="def_ModelManipulationRule.html" title="4.4.1.&nbsp;Model Manipulation Rule">model manipulation rule</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_CreateRule.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="sec_ASMModelManipulationRules.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="def_CopyRule.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">4.4.2.&nbsp;Create Rule&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.4.4.&nbsp;Copy Rule</td></tr></table></div></body></html>