Won&#39;t that just make the rule activate after 3 minutes?<br><br>rule AnoB<br>when<br>    $a: A( status == &quot;waiting for B&quot; )<br>    not B( this after [3m] $a )<br>then<br>    modify( $a ){ setStatus( &quot;no B within 3m after me&quot; ) }<br>

end<br><br>Is this any good?<br><br>Also &quot;untested&quot; ;)<br><br><div class="gmail_quote">2011/7/5 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Try a rule with a timer:<br><br>rule AnoB<br>timer( int: 3m )<br>when<br>    $a: A( status == &quot;waiting for B&quot; )<br>
    not B( this after $a )<br>then<br>    modify( $a ){ setStatus( &quot;no B within 3m after me&quot; ) }<br>
end<br><br>Untested.<br><font color="#888888">-W</font><div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On 5 July 2011 13:00, wendy <span dir="ltr">&lt;<a href="mailto:w.mungovan@yahoo.com" target="_blank">w.mungovan@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
  I&#39;m having trouble writing an absence pattern.  What I&#39;m trying to do is<br>
detect when there is an A followed by no Bs for 3+minutes.  I don&#39;t care if<br>
there is more than one A.  What I&#39;m running into is that when I try to use<br>
&#39;over window:time&#39; the time within drools is the end time of the window.  So<br>
this means I need to write the no Bs for 3+ min first:<br>
<br>
not( $b: B() over window:time(3m))<br>
<br>
then try to find the A before it:<br>
<br>
$now: Long() from RuleUtilityFunctions.getSessionClockTime()<br>
$a: A( this before [3m] $now)<br>
<br>
then I should have to check to make sure that I don&#39;t have any Bs between<br>
$a&#39;s time and the start of the no B window:<br>
<br>
not( B( time &gt;= $a.time,<br>
           time &lt;= $now))<br>
<br>
This is not working.  I think that it has something to do with my function<br>
to get the session clock time (RuleUtilityFunctions.getSessionClockTime())<br>
and how things get evaluated within the Rete engine.  Because it does not<br>
seem like $now is getting re-evaluated on future calls that pass the $b<br>
condition.  If I replace $now with the call to getSessionClockTime()<br>
everything just seems to get weird.<br>
<br>
I&#39;ve tried to write the rule forward too.  Look for A followed by no B but<br>
that does not seem to work because A is matched at the current time and the<br>
rule triggers because there is no B because the future B data has not be<br>
inserted into working memory yet.<br>
<br>
What is the right way to write this rule?   Is there a way to get the start<br>
and end time of the time window that met the over window:time() condition?<br>
<br>
Thank you,<br>
Wendy<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Absence-Pattern-question-tp3140377p3140377.html" target="_blank">http://drools.46999.n3.nabble.com/Absence-Pattern-question-tp3140377p3140377.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" target="_blank">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>
</font></blockquote></div><br>
</div></div><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>
<br></blockquote></div><br>