<br>    Although your rule should work, the best way to write your rule would be using temporal constraints instead of sliding windows:<br><br>rule &quot;Goodbye before Hello World&quot;<br>
        when<br>
                $m : Message( status == Message.HELLO )<br>
                exists( Message( status == Message.GOODBYE, this before[0s,3s] $m ) )<br>
        then<br>
                System.out.println( &quot;There was a GOODBYE message before the HELLO<br>
message.&quot; );<br>
end<br><br>    Using &quot;before&quot; operator is not only much cheaper (in terms of used resources) than sliding windows, but it also allow the engine to reason over the temporal constraints looking for special cases, like when you use negative patterns.<br>
<br>    I will look further into your case to check if I missed anything on the sliding windows support, but using STREAM mode should work. <br><br>    If you can open a JIRA for me to raise a compilation error when compiling sliding windows using CLOUD mode, I appreciate. This will allow you to follow up my progress.<br>
<br>    []s<br>    Edson<br><br><br><div class="gmail_quote">2009/3/30 ober0n <span dir="ltr">&lt;<a href="mailto:lili339@hotmail.com">lili339@hotmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Ed, no need to apologize, you have been invaluable in my first steps<br>
towards Drooling :-D so thanks for all your help, it is GREATLY appreciated<br>
:clap:.<br>
<br>
We have a few scenarios in mind but aren&#39;t really implementing them yet,<br>
just trying to see if sliding windows works the way we think it does. In the<br>
simple rule I wrote above, I basically want to check if two facts are<br>
temporally close.<br>
<br>
Yes, you are correct. I didn&#39;t pay enough attention to the manual and didn&#39;t<br>
use STREAM mode to enter in my facts. I will use the manual insertion<br>
process found in &quot;Example 2.10. Inserting facts into an entry point&quot; of<br>
section &quot;2.3. Streams Support&quot; to update my code. And, I will update my rule<br>
to specify a &quot;from entry-point &lt;Specific Stream&gt;&quot;.<br>
<br>
Also, could you comment on the simple rule I am using? Does it look like it<br>
should work after I do the updates? Or is my logic incorrect?<br>
<br>
Thanks again.<br>
<div><div></div><div class="h5"><br>
<br>
<br>
   Ober0n,<br>
<br>
   Sorry for the delay on answering. I am on a trip with limited internet<br>
connection.<br>
   I am interested in your experience with the sliding windows, since the<br>
tests are working. Maybe it is a scenario not covered by the tests.<br>
<br>
   In any case, what is probably happening is that you are not configuring<br>
the engine to work in STREAM mode. The default mode is CLOUD and it does not<br>
support sliding windows. It seems the engine is silently failing in this<br>
case, when the compiler raise an error to warn the user.<br>
<br>
    I just committed some docs on this subject:<br>
<br>
<a href="https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html/ch02.html#d0e1067" target="_blank">https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html/ch02.html#d0e1067</a><br>

<br>
    (plz, wait for hudson to rebuild the docs or build docs yourself).<br>
<br>
    Feedback welcome. I will complement the sliding window docs.<br>
<br>
    []s<br>
    Edson<br>
<br>
2009/3/29 ober0n &lt;<a href="mailto:lili339@hotmail.com">lili339@hotmail.com</a>&gt;<br>
<br>
&gt;<br>
&gt; Still trying to get sliding windows to work (basing my code off of the<br>
&gt; Eclipse supplied &quot;Hello World&quot; example). I don&#39;t think I fully understand<br>
&gt; how it works yet so I&#39;m trying to simplify things even further by writing<br>
&gt; a<br>
&gt; simple rule that is meant to say:<br>
&gt;<br>
&gt; if (current_message = &quot;Hello&quot; AND exists( goodbye_message within<br>
&gt; sliding_window(3 seconds) ))<br>
&gt; then print(&quot;There was a GOODBYE message before the HELLO message.&quot; )<br>
&gt;<br>
&gt; In other words: This rule should fire if the current Hello World message<br>
&gt; was<br>
&gt; preceeded within 3 seconds by a goodbye message.<br>
&gt;<br>
&gt;<br>
&gt; ---------------------------------------------------------------------------------------------------<br>
&gt; I wrote a new rule for this:<br>
&gt;<br>
&gt; declare Message<br>
&gt;    @role( event )<br>
&gt; end<br>
&gt;<br>
&gt; rule &quot;Goodbye before Hello World&quot;<br>
&gt;        when<br>
&gt;                Message( status == Message.HELLO )<br>
&gt;                exists( Message( status == Message.GOODBYE ) over<br>
&gt; window:time( 3s ) )<br>
&gt;        then<br>
&gt;                System.out.println( &quot;There was a GOODBYE message before the<br>
&gt; HELLO<br>
&gt; message.&quot; );<br>
&gt; end<br>
&gt;<br>
&gt;<br>
&gt; ---------------------------------------------------------------------------------------------------<br>
&gt;<br>
&gt; To send the messages: (ksession is a StatefulKnowledgeSession)<br>
&gt;<br>
&gt;                        ...<br>
&gt;                        ksession.insert(goodbye_message);<br>
&gt;                        ksession.fireAllRules();<br>
&gt;<br>
&gt;                        Thread.sleep(5000);<br>
&gt;<br>
&gt;                        ksession.insert(hello_message);<br>
&gt;                        ksession.fireAllRules();<br>
&gt;                        ...<br>
&gt;<br>
&gt; ---------------------------------------------------------------------------------------------------<br>
&gt;<br>
&gt; I expect to get nothing back since I sent the Hello message 5 seconds<br>
&gt; after<br>
&gt; the goodbye message (outside the sliding window of 3 seconds). But, for<br>
&gt; some<br>
&gt; reason the rule fires and I get one:<br>
&gt;<br>
&gt; &quot;There was a GOODBYE message before the HELLO message.&quot;<br>
&gt;<br>
&gt; Any help would be greatly appreciated.<br>
&gt;<br>
&gt; Thanks!<br>
&gt; --<br>
&gt; View this message in context:<br>
&gt; <a href="http://www.nabble.com/Trying-to-get-Sliding-Windows-to-work-tp22735051p22770318.html" target="_blank">http://www.nabble.com/Trying-to-get-Sliding-Windows-to-work-tp22735051p22770318.html</a><br>
&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
<br>
<br>
<br>
--<br>
 Edson Tirelli<br>
 JBoss Drools Core Development<br>
 JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
<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>
<br>
<br>
--<br>
</div></div>View this message in context: <a href="http://www.nabble.com/Trying-to-get-Sliding-Windows-to-work-tp22735051p22785711.html" target="_blank">http://www.nabble.com/Trying-to-get-Sliding-Windows-to-work-tp22735051p22785711.html</a><br>

<div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<br>
<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>