blob: a5ca727dd4230e5c2bf30f6cdc2bfef2575784f4 [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.1.3.&nbsp;Negative Pattern</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_PatternBody.html" title="2.1.2.&nbsp;Pattern Body"><link rel="next" href="def_GraphPatternCall.html" title="2.1.4.&nbsp;Graph Pattern Call"></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.3.&nbsp;Negative Pattern</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="def_PatternBody.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="def_GraphPatternCall.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_NegativePattern"></a>2.1.3.&nbsp;Negative Pattern</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_NegativePattern_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
Negative patterns define negative constraints in a
<a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">pattern body</a>:
if a negative pattern can be matched then the match of the container pattern fails.
</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_NegativePattern_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
NegativePatternAST ::= <span class="token">neg</span> <a href="def_PatternComposition.html" title="2.1.5.&nbsp;Pattern Composition">PatternCompositionAST</a>
// See also: <a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">PatternBodyContentDefAST</a>
</pre><p>
A
<span class="strong"><strong>negative pattern</strong></span>
<a name="N104EE" class="indexterm"></a>
is composed of the <code class="computeroutput">neg</code> keyword and a <a href="def_GraphPatternDef.html" title="2.1.1.&nbsp;Graph Pattern Definition">pattern definition</a> or
<a href="def_PatternComposition.html" title="2.1.5.&nbsp;Pattern Composition">pattern composition</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_NegativePattern_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
Negative patterns typically search for some prohibited context of the partial match of the container
(positive) pattern. If a match is found for the negative pattern, then the match of the container pattern is
invalidated.
</p><p>
When a pattern has multiple negative subpatterns, a successful matching of any of its subpatterns
invalidates the container pattern.
</p><p>
When a negative pattern itself has an embedded negative subpattern (i.e. negation of negation) then the
matching of the subpattern may invalidate the matching of the negative pattern itself, thus the original
(positive) container pattern is not invalidated.
</p><p>
Note that when a match is found for a negative pattern, no assignment of pattern variables is passed back to
its container pattern.
</p></td></tr></table></div><div class="highlights"><a name="def_NegativePattern_DefinedIn"></a><p><b>Defined In:&nbsp;</b>
<a href="def_PatternBody.html" title="2.1.2.&nbsp;Pattern Body">pattern body</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_PatternBody.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="def_GraphPatternCall.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">2.1.2.&nbsp;Pattern Body&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.1.4.&nbsp;Graph Pattern Call</td></tr></table></div></body></html>