<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Inconsolata;
        panose-1:2 11 6 9 3 0 3 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE-AT link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thank you for the quick answer! This makes absolutely sense and the rules work now as expected.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Unfortunately, I was not able to find this somewhere in the documentation. It would be nice to see it in the documentation of drools fusion. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Wolfgang<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-GB style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Von:</span></b><span lang=EN-GB style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] <b>Im Auftrag von </b>Wolfgang La</span><span lang=DE style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>un<br><b>Gesendet:</b> Montag, 16. Jänner 2012 15:58<br><b>An:</b> Rules Users List<br><b>Betreff:</b> Re: [rules-users] Problem with Negative Patterns and Temporal Constraints<o:p></o:p></span></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>I don't see that the &quot;not&quot; CE excludes the AnalysisCue bound to $cue from being<br>matched by the pattern inside the &quot;not&quot;. I recommend using<br><br><b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata;color:#960000'>&nbsp;&nbsp; not</span></b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>(AnalysisCue(<b>this != $cue</b>, <span style='color:#960000'>this</span> after[0ms,2500ms] $cue) <span style='color:#960000'>from</span></span><br><br>since &quot;[0ms,...&quot; does not inhibit the same event being matched by both patterns,<br>which precludes the rule from firing.<br><br>-W<br><br><o:p></o:p></p><div><p class=MsoNormal>2012/1/16 Weiss, Wolfgang &lt;<a href="mailto:Wolfgang.Weiss@joanneum.at">Wolfgang.Weiss@joanneum.at</a>&gt;<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>Hi all!</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>We have the problem that the following rule never fires:</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata;color:#960000'>rule</span></b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'> <span style='color:green'>&quot;test-rule&quot;</span></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>agenda-group</span></b> <span style='color:green'>&quot;evaluation&quot;</span></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>salience</span></b> 100</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>when</span></b></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $cue : AnalysisCue() <b><span style='color:#960000'>from</span></b> entry-point <span style='color:green'>&quot;LowLevelCueStream&quot;</span></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>not</span></b>(AnalysisCue(<b><span style='color:#960000'>this</span></b> after[0ms,2500ms] $cue) <b><span style='color:#960000'>from</span></b> entry-point <span style='color:green'>&quot;LowLevelCueStream&quot;</span>)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>then</span></b></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.debug(<span style='color:green'>&quot;... some message ..&quot;</span>);</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata;color:#960000'>end</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>We found out that the problem is the combination of the negation with the conditional element &#8220;not&#8221; and the temporal constraint &#8220;[0ms,2500ms]&#8221;. Using the temporal operator &#8220;this after $cue&#8221; without a temporal constraint works correct in its semantics.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>Interestingly, when adding a constraint (cueType == 1) to the type in the negative pattern the rule begins to work. The rule would look like as follows:</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata;color:#960000'>rule</span></b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'> <span style='color:green'>&quot;test-rule&quot;</span></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>agenda-group</span></b> <span style='color:green'>&quot;evaluation&quot;</span></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>salience</span></b> 100</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>when</span></b></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $cue : AnalysisCue() <b><span style='color:#960000'>from</span></b> entry-point <span style='color:green'>&quot;LowLevelCueStream&quot;</span></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>not</span></b>(AnalysisCue(cueType == 1, <b><span style='color:#960000'>this</span></b> after[0ms,2500ms] $cue) <b><span style='color:#960000'>from</span></b> entry-point <span style='color:green'>&quot;LowLevelCueStream&quot;</span>)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><span style='color:#960000'>then</span></b></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.debug(<span style='color:green'>&quot;... some message ..&quot;</span>);</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-GB style='font-size:10.0pt;font-family:Inconsolata;color:#960000'>end</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>unfortunately the rule then fires with a delay of 4 to 5 seconds. The second parameter of the temporal constraint influences the delay.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>When changing the first parameter of the temporal constraint to a value greater than 0 the rule works as expected! The constraint would then look like as follows: &#8220;[1ms, 2500ms]&#8221;. Whereas in our case, we want to evaluate the time window from 0 &#8211; 2500ms.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>Our system works in the stream mode and we could reproduce this behaviour with the versions 5.3.1 and 5.4.0 Beta 1. </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>Can anybody confirm if this is a bug in Drools, or did I overlook here something?</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB>Best regards,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB style='color:#888888'>Wolfgang Weiss</span><span style='color:#888888'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB style='color:#888888'>&nbsp;</span><span style='color:#888888'><o:p></o:p></span></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>