A sliding window requires the use of STREAM mode, and you must use a <br>session clock, pseudo or real-time.<br><br>I&#39;m also a worried about &quot;size==80&quot;; shouldn&#39;t you use &quot;size &gt;= 80&quot;?<br>But this depends on the way you run the session; are you doing this<br>
with fireUntilHalt in a separate thread?<br><br>It shouldn&#39;t be a problem if the session is run with a real-time clock and<br>delayed events (with the timestamp in the data, as you apparently have)<br>arrive and are inserted. Docs say that that this is OK, as long as events<br>
are inserted in each entry-point in chronological order. If there are<br>different streams, each with individual delays, you may have to use<br>multiple entry-points. <br><br><br><div class="gmail_quote">On 1 December 2010 16:10, Anais Martinez <span dir="ltr">&lt;<a href="mailto:amartinez@iti.upv.es">amartinez@iti.upv.es</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;"><br>
Hello. I have two questions about collect and sliding windows. I have created<br>
this rule:<br>
<br>
rule &quot;Active risk&quot;<br>
when<br>
 $n:Node()<br>
 $readings: ArrayList(size==80)  from collect(<br>
   Reading( nodeID == $n.nodeID,<br>
    (signalType == SignalType.PLUVIOSITY &amp;&amp; value &gt;= 10)||<br>
    (signalType == SignalType.AIR_TEMPERATURE &amp;&amp; value&gt;=12)<br>
   ) over window:time(10h))<br>
then<br>
  System.out.println(&quot;Active risk in node &quot;+ $n.getNodeID());<br>
end<br>
<br>
And the declarations are the following (Reading and Node are java classes):<br>
<br>
declare Reading<br>
        @role(event)<br>
        @timestamp (timestamp)<br>
end<br>
<br>
declare Node<br>
        @role(fact)<br>
end<br>
<br>
<br>
Well, I have probe the rule. I have inserted 100 readings which satisfy the<br>
conditions, in a single time but with different timestamp (I have simulated<br>
that there are a pluviosity reading and a air_temperature reading each 15<br>
minutes), that is, in main:<br>
<br>
long init= 1290729600000L;<br>
long interval = 1000*60*15;<br>
for (int i=0; i&lt;100; i++){<br>
        long fecha = init+i*interval;<br>
        Reading r1 = new Reading(SignalType.PLUVIOSITY, value1, node);<br>
        session.insert(r1);<br>
<br>
        Reading r2 = new Reading(SignalType.AIR_TEMPERATURE, value1, node);<br>
        session.insert(r2);<br>
}<br>
<br>
The message is not written (I have fired rules after insertions).<br>
<br>
My questions:<br>
Has drools any problem if I inserted all readings at same time? (Do I have<br>
to use the pseudo-clock?)<br>
My problem is that the readings will be sent from a server in real system,<br>
and it&#39;s possible that the server will send all readings belonging to an<br>
interval of one/two hour/s at same time.<br>
<br>
Thanks.<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Question-about-collect-and-sliding-windows-tp1999562p1999562.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Question-about-collect-and-sliding-windows-tp1999562p1999562.html</a><br>

Sent from the Drools - User 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>
</font></blockquote></div><br>