You say that the first rule is working, but then you also write that<div>if the first event is a RawEvent neither one works. Isn&#39;t this a contradiction?</div><div><br></div><div>According to the definition and using &quot;t&quot; for &quot;timestamp&quot;, we have</div>
<div>   A after[x,y] B  </div><div>equalling, by definition </div><div>   x &lt;= A.t - B.t &lt;= y</div><div>or</div><div>   B.t + x &lt;= A.t &lt;= B.t + y</div><div>and with [x,y] set to [0,90s] we have</div><div>   B.t &lt;= A.t &lt;= B.t + 90</div>
<div><br></div><div>(A before[x,y] B is the same except for exchanging the roles of A and B.)</div><div><br></div><div>However, any RawEvent R inhibits both rules from firing, since it matches</div><div>both the pattern after $start and the pattern after &quot;not&quot;: its &quot;id&quot; is necessarily the same and clearly</div>
<div>  R.t &lt;= R.t &lt;= R.t + 90</div><div><br></div><div>Try adding </div><div>   not RawEvent( this != $start, id == $<a href="http://start.id/" target="_blank">start.id</a>,...</div><div><br></div><div>-W</div><div>
<br></div><div><br><br><div class="gmail_quote">On 1 September 2012 17:28, Rob21 <span dir="ltr">&lt;<a href="mailto:rob.perrez@gmail.com" target="_blank">rob.perrez@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
I try to detect the beginning of a scenario which is characterized by an<br>
event happening after no other event of the same type has happened in the<br>
last 90sec.<br>
I can&#39;t understand why only the first of those two rules is working.<br>
<br>
rule &quot;Detect Scenario beginning&quot;<br>
    when<br>
        $start : RawEvent()<br>
        not RawEvent(id == $<a href="http://start.id" target="_blank">start.id</a>, $start after[0ms, 90s] this)<br>
    then<br>
    System.out.println($start);<br>
end<br>
<br>
rule &quot;Detect Scenario beginning alt&quot;<br>
    when<br>
        $start : RawEvent()<br>
        not RawEvent(id == $<a href="http://start.id" target="_blank">start.id</a>, this before[0ms, 90s] $start)<br>
    then<br>
    System.out.println($start);<br>
end<br>
<br>
Moreover if the first sent event is a rawEvent none of them will detect it.<br>
Where am i wrong ? (still a beginner with drools)<br>
PS : I already posted it on the forum, but i forgot to complete all the<br>
subscription steps so it was rejected. Sorry for the double post.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/before-after-behavior-for-negative-pattern-tp4019497.html" target="_blank">http://drools.46999.n3.nabble.com/before-after-behavior-for-negative-pattern-tp4019497.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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><br>
</blockquote></div><br></div>