<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:10pt"><div class="" style=""><span style="font-size: 10pt;">I found one of the explanations on how Sliding Windows
operate in Drools while searching for an answer:</span><br></div><div class="" style=""><o:p class="" style=""></o:p></div><div class="" style="">“<i class="" style="">Events are expired
from the&nbsp;time&nbsp;window&nbsp;when the clock advances</i>”<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">So, in my case if I am inserting events on T0 (insert 1<sup class="" style="">st</sup>
event), T1 (insert 2<sup class="" style="">nd</sup> event), T2 (insert 3<sup class="" style="">rd</sup> event) and
advancing the clock to T3, T4 and T5; 1<sup class="" style="">st</sup> event inserted at T0 is
expired from the window. And the rule calculates the average of the last two
events (2<sup class="" style="">nd</sup> event &amp; 3<sup class="" style="">rd</sup> event) falling in the time
window. And the output average calculated by the from accumulate function comes
to be (26 +28 / 2 == 27) satisfying the contract of average temperature to be above
the threshold value of 25.<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">Now let’s say I do the below (advancing the clock by 5
minutes after the 3<sup class="" style="">rd</sup> insert):<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">T0 (insert 1<sup class="" style="">st</sup> event)<o:p class="" style=""></o:p></div><div class="" style="">T1 (insert 2<sup class="" style="">st</sup> event)<o:p class="" style=""></o:p></div><div class="" style="">T2 (insert 3<sup class="" style="">st</sup> event)<o:p class="" style=""></o:p></div><div class="" style="">T3<o:p class="" style=""></o:p></div><div class="" style="">T4<o:p class="" style=""></o:p></div><div class="" style="">T5<o:p class="" style=""></o:p></div><div class="" style="">T6<o:p class="" style=""></o:p></div><div class="" style="">T7<o:p class="" style=""></o:p></div><div class="" style="">Fire all rules <o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">The average calculated by
 the rule is zero (0) since the
three inserted events fall outside the time window of 5 minutes (as expected).
But, my rule fires regardless of the fact I have the contract of average temperature
to be greater than threshold in my rule : <o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">$averageTemp : Number(<b class="" style="">intValue
&gt; 25</b>)&nbsp;&nbsp;&nbsp; <o:p class="" style=""></o:p></div><div class="" style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from accumulate(SensorReading($temp : temperature) <o:p class="" style=""></o:p></div><div class="" style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; over window:time(5m) from
entry-point "Temperature Reading", average($temp))<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">As per the drools-fusion documentation, <b class="" style="">over window : time(X)</b> is used to consider events that happened in
the last X units. So, is there something that needs to be changed in my rule
implementation?<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">One more question here, does <b class="" style="">over window : time(X) </b>really considers events occurred in the last
X units. I tried going further by doing the below:<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">T0 (insert 1<sup class="" style="">st</sup> event – Sensor reading is 24)<o:p class="" style=""></o:p></div><div class="" style="">T1 (insert 2<sup class="" style="">st</sup> event – Sensor reading is 26)<o:p class="" style=""></o:p></div><div class="" style="">T2 (insert 3<sup class="" style="">st</sup> event – Sensor reading is 28)<o:p class="" style=""></o:p></div><div class="" style="">T3<o:p class="" style=""></o:p></div><div class="" style="">T4<o:p class="" style=""></o:p></div><div class="" style="">T5<o:p class="" style=""></o:p></div><div class="" style="">T6<o:p class="" style=""></o:p></div><div class="" style="">T7<o:p class="" style=""></o:p></div><div class="" style="">(insert event – Sensor reading is 30)<o:p class="" style=""></o:p></div><div class=""
 style="">Fire All rules<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">With the above test setup, my rule gets invoked twice printing
the average of temperatures as (30) and (30). But using <b class="" style="">over window:time(5m) </b>shouldn’t result in rule being triggered once ?<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">Thanks in advance!<o:p class="" style=""></o:p></div><div class="" style=""><span class="" style="">





















































































</span></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: times new roman, new york, times, serif; font-size: 10pt;" class=""> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;" class=""> <div dir="ltr" class="" style=""> <font size="2" face="Arial" class="" style=""> On Thursday, 5 June 2014 1:35 PM, Sushant Goyal &lt;sushantgoyal25@yahoo.co.in&gt; wrote:<br class="" style=""> </font> </div>  <br class="" style=""><br class="" style=""> <div class="" style=""><div id="yiv5283390172" class="" style=""><div class="" style=""><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:10pt;" class=""><div class="" style="">Thanks again for your response Wolfgang.</div><div class="" style=""> &nbsp;</div><div class="" style="">I found one of
 the explanations on how Sliding Windows
operate in Drools while searching for an answer:</div><div class="" style="">“<i class="" style="">Events are expired
from the&nbsp;time&nbsp;window&nbsp;when the clock advances</i>”</div><div class="" style=""> &nbsp;</div><div class="" style="">So, in my case if I am inserting events on T0 (insert 1<sup class="" style="">st</sup>
event), T1 (insert 2<sup class="" style="">nd</sup> event), T2 (insert 3<sup class="" style="">rd</sup> event) and
advancing the clock to T3, T4 and T5; 1<sup class="" style="">st</sup> event inserted at T0 is
expired from the window. And the rule calculates the average of the last two
events (2<sup class="" style="">nd</sup> event &amp; 3<sup class="" style="">rd</sup> event) falling in the time
window. And the output average calculated by the from accumulate function comes
to be (26 +28 / 2 == 27) satisfying the contract of average temperature to be above
the threshold value of 25.</div><div class="" style=""> &nbsp;</div><div class="" style="">Now let’s say I do the below (advancing the clock by 5
minutes after the 3<sup class="" style="">rd</sup> insert):</div><div class="" style=""> &nbsp;</div><div class="" style="">T0 (insert 1<sup class="" style="">st</sup> event)</div><div class="" style="">T1 (insert 2<sup class="" style="">st</sup> event)</div><div class="" style="">T2 (insert 3<sup class="" style="">st</sup> event)</div><div class="" style="">T3</div><div class="" style="">T4</div><div class="" style="">T5</div><div class="" style="">T6</div><div class="" style="">T7</div><div class="" style="">Fire all rules </div><div class="" style=""> &nbsp;</div><div class="" style="">The average calculated by
 the rule is zero (0) since the
three inserted events fall outside the time window of 5 minutes (as expected).
But, my rule fires regardless of the fact I have the contract of average temperature
to be greater than threshold in my rule : </div><div class="" style=""> &nbsp;</div><div class="" style="">$averageTemp : Number(<b class="" style="">intValue
&gt; 25</b>)&nbsp;&nbsp;&nbsp; </div><div class="" style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from accumulate(SensorReading($temp : temperature) </div><div class="" style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; over window:time(5m) from
entry-point "Temperature Reading", average($temp))</div><div class="" style=""> &nbsp;</div><div class="" style="">As per the drools-fusion documentation, <b class="" style="">over window : time(X)</b> is used to consider events that happened in
the last X units. So, is there something that needs to be changed in my rule
implementation?</div><div class="" style=""> &nbsp;</div><div class="" style="">One more question here, does <b class="" style="">over window : time(X) </b>really considers events occurred in the last
X units. I tried going further by doing the below:</div><div class="" style=""> &nbsp;</div><div class="" style="">T0 (insert 1<sup class="" style="">st</sup> event – Sensor reading is 24)</div><div class="" style="">T1 (insert 2<sup class="" style="">st</sup> event – Sensor reading is 26)</div><div class="" style="">T2 (insert 3<sup class="" style="">st</sup> event – Sensor reading is 28)</div><div class="" style="">T3</div><div class="" style="">T4</div><div class="" style="">T5</div><div class="" style="">T6</div><div class="" style="">T7</div><div class="" style="">(insert event – Sensor reading is 30)</div><div class="" style="">Fire All rules</div><div class="" style=""> &nbsp;</div><div class="" style="">With the above test setup, my rule gets invoked twice printing
the average of temperatures as (30) and (30). But using <b class="" style="">over window:time(5m) </b>shouldn’t result in rule being triggered once ?</div><div class="" style=""> &nbsp;</div><div class="" style="">Thanks in advance!</div><div class="" style=""><span class="" style="">





















































































</span></div><div class="" style=""> &nbsp;</div> <div class="" style=""><br clear="none" class="" style=""><br clear="none" class="" style=""></div><div class="" id="yiv5283390172yqt68171" style=""><div class="" style="display:block;"> <div class="" style="font-family:times new roman, new york, times, serif;font-size:10pt;"> <div class="" style="font-family:times new roman, new york, times, serif;font-size:12pt;"> <div class="" dir="ltr" style=""> <font class="" size="2" face="Arial" style=""> On Thursday, 5 June 2014 12:31 PM, Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt; wrote:<br clear="none" class="" style=""> </font> </div>  <br clear="none" class="" style=""><br clear="none" class="" style=""> <div class="" style="">Computations involving intervals where events arrive in real time<br clear="none" class="" style="">should not depend on differences of one unit of the smalles unit of<br clear="none" class="" style="">time for specifying durations
 (here: milliseconds).<br clear="none" class="" style=""><br clear="none" class="" style="">-W<br clear="none" class="" style=""><br clear="none" class="" style=""><br clear="none" class="" style=""><div class="" id="yiv5283390172yqtfd17069" style=""><br clear="none" class="" style="">On 04/06/2014, Sushant Goyal &lt;<a rel="nofollow" shape="rect" class="" ymailto="mailto:sushantgoyal25@yahoo.co.in" target="_blank" href="mailto:sushantgoyal25@yahoo.co.in" style="">sushantgoyal25@yahoo.co.in</a>&gt; wrote:<br clear="none" class="" style="">&gt; Thanks for your response.<br clear="none" class="" style="">&gt; I was under the assumption that the window time frame begins, the moment<br clear="none" class="" style="">&gt; first event is inserted into the working memory. Or I am still missing out<br clear="none" class="" style="">&gt; something here (when you say that the first event is exactly at the<br clear="none" class="" style="">&gt; beginning of the
 window)?&nbsp; If I traverse backwards as below, then definitely<br clear="none" class="" style="">&gt; the 1st event lies outside the
 window.<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt;&nbsp;  insert 1st event<br clear="none" class="" style="">&gt;&nbsp;  delay 1 minute ^&nbsp; (4 + 1 = 5)<br clear="none" class="" style="">&gt;&nbsp;  insert 2nd event<br clear="none" class="" style="">&gt;&nbsp;  delay 1 minute&nbsp; ^ (3 + 1 = 4)<br clear="none" class="" style="">&gt;&nbsp;  insert 3rd event<br clear="none" class="" style="">&gt;&nbsp;  delay 1 minute&nbsp;  ^ (2 + 1 = 3)<br clear="none" class="" style="">&gt;&nbsp;  delay 2 minutes&nbsp; ^<br clear="none" class="" style="">&gt;&nbsp;  fire all rules<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; However, if I start from the 1st event, the possibility where 1st event lies<br clear="none" class="" style="">&gt; out of time frame of 5 mins would be if certain amount of time is<br clear="none" class="" style="">&gt; consumed while inserting the 1st event. I tried to check
 it programmatically<br clear="none" class="" style="">&gt; to see if there is any time lapsed during the insertion of the event by<br clear="none" class="" style="">&gt; printing the clock's current time using clock.getCurrentTime() method before<br clear="none" class="" style="">&gt; and after inserting the 1st event, however, could not notice any difference.<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; But, if I change the time to be advanced by 1 minutes and 59 seconds<br clear="none" class="" style="">&gt; (instead of 2 minutes) towards the end after the three events have been<br clear="none" class="" style="">&gt; inserted, the rule seems to be working fine by considering all the three<br clear="none" class="" style="">&gt; events for calculating the average.<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; I know I am definitely missing out something here as I can see the<br
 clear="none" class="" style="">&gt; difference in the behavior of the rule by merely reducing the total delay in<br clear="none" class="" style="">&gt; time by 1 second (4 min 59 sec instead of 5 minutes) as stated above. But I<br clear="none" class="" style="">&gt; am not able to figure that out.<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; Could you please provide more insight.<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; Thanks!<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; On Wednesday, 4 June 2014 9:01 PM, Wolfgang Laun &lt;<a rel="nofollow" shape="rect" class="" ymailto="mailto:wolfgang.laun@gmail.com" target="_blank" href="mailto:wolfgang.laun@gmail.com" style="">wolfgang.laun@gmail.com</a>&gt;<br clear="none" class="" style="">&gt; wrote:<br clear="none" class="" style="">&gt;<br clear="none" class=""
 style="">&gt;<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; Your code does:<br clear="none" class="" style="">&gt;&nbsp;  insert 1st event<br clear="none" class="" style="">&gt;&nbsp;  delay 1 minute<br clear="none" class="" style="">&gt;&nbsp;  insert 2nd event<br clear="none" class="" style="">&gt;&nbsp;  delay 1 minute<br clear="none" class="" style="">&gt;&nbsp;  insert 3rd event<br clear="none" class="" style="">&gt;&nbsp;  delay 1 minute<br clear="none" class="" style="">&gt;&nbsp;  delay (1 or) 2 minutes<br clear="none" class="" style="">&gt;&nbsp;  fire all rules<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; In the second case, 5 minutes have elapsed since the 1st insert. I<br clear="none" class="" style="">&gt; don't think that this means "that [the 1st insert] falls well within<br clear="none" class="" style="">&gt; the specified time range" - it is exactly at the beginning of
 the<br clear="none" class="" style="">&gt;
 window, and I'd expect the window to be an interval open at one end -<br clear="none" class="" style="">&gt; otherwise events smack on the point in time "separating" two intervals<br clear="none" class="" style="">&gt; would be in both windows.<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; -W<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; On 04/06/2014, Sushant Goyal &lt;<a rel="nofollow" shape="rect" class="" ymailto="mailto:sushantgoyal25@yahoo.co.in" target="_blank" href="mailto:sushantgoyal25@yahoo.co.in" style="">sushantgoyal25@yahoo.co.in</a>&gt; wrote:<br clear="none" class="" style="">&gt;&gt; Hi,<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; I am<br clear="none" class="" style="">&gt;&gt; trying to understand how Drools can be used to monitor events over a<br clear="none" class="" style="">&gt;&gt;
 period<br clear="none" class="" style="">&gt;&gt; of<br clear="none" class="" style="">&gt;&gt; time using Sliding Time Windows. I have created a rule to sound an alarm<br clear="none" class="" style="">&gt;&gt; when<br clear="none" class="" style="">&gt;&gt; average temperature read from a sensor is above 25 degrees (threshold)<br clear="none" class="" style="">&gt;&gt; over<br clear="none" class="" style="">&gt;&gt; a<br clear="none" class="" style="">&gt;&gt; time period of 5 minutes. The rule makes of use of the Stream processing<br clear="none" class="" style="">&gt;&gt; mode so<br clear="none" class="" style="">&gt;&gt; that continuous stream of events could be processed.<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; Below<br clear="none" class="" style="">&gt;&gt; is how my rule looks like:<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; //declare any global<br
 clear="none" class="" style="">&gt;&gt;
 variables here<br clear="none" class="" style="">&gt;&gt; globaljava.lang.StringBuilder alertMessage<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; // add declaration to<br clear="none" class="" style="">&gt;&gt; change the Fact into an Event<br clear="none" class="" style="">&gt;&gt; declareSensorReading<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @role(event)<br clear="none" class="" style="">&gt;&gt; end<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; /* Alert when average<br clear="none" class="" style="">&gt;&gt; temperature is above 25<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; over a time period of 5 minutes */<br clear="none" class="" style="">&gt;&gt; rule"TemperatureAlarm1"<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp;  when<br clear="none" class="" style="">&gt;&gt;&nbsp;
 &nbsp; &nbsp; &nbsp;  //conditions<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  $averageTemp : Number(doubleValue &gt;<br clear="none" class="" style="">&gt;&gt; 25.00)<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fromaccumulate(SensorReading($temp<br clear="none" class="" style="">&gt;&gt; : temperature)<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  over<br clear="none" class="" style="">&gt;&gt; window:time(5m) fromentry-point "Temperature Reading", average($temp))<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp;  then<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  //actions<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fired rule:<br
 clear="none" class="" style="">&gt;&gt; "+<br clear="none" class="" style="">&gt;&gt; kcontext.getRule().getName());<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  alertMessage.append("Threshold<br clear="none" class="" style="">&gt;&gt; temperature breached!!"+<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "\nTurn on the<br clear="none" class="" style="">&gt;&gt; Air Conditioner"+<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "\nAverage<br clear="none" class="" style="">&gt;&gt; temperature over 5 minutes is above 25 ("+ $averageTemp.intValue() +<br clear="none" class="" style="">&gt;&gt; ")\n");<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; end<br clear="none" class="" style="">&gt;&gt;<br clear="none"
 class="" style="">&gt;&gt; And below<br clear="none" class="" style="">&gt;&gt; is the snapshot of the fact (SensorReading) which is inserted as an event<br clear="none" class="" style="">&gt;&gt; in<br clear="none" class="" style="">&gt;&gt; the working memory:<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; publicclassSensorReading {<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatedoubletemperature;<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicSensorReading(){}<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicSensorReading(doubletemp){<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this.temperature= temp;<br clear="none" class="" style="">&gt;&gt;&nbsp;
 &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; // getters and setters<br clear="none" class="" style="">&gt;&gt; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; In<br clear="none" class="" style="">&gt;&gt; order to test the rule, I am using Pseudo Clock with Stream processing<br clear="none" class="" style="">&gt;&gt; turned<br clear="none" class="" style="">&gt;&gt; on. I am inserting three SensorReading objects in the working memory with<br clear="none" class="" style="">&gt;&gt; temperature<br clear="none" class="" style="">&gt;&gt; values as (24, 26, 28) after every minute, so that the average of the<br clear="none" class="" style="">&gt;&gt; temperatures is above threshold and the rule is invoked. After the objects<br clear="none" class="" style="">&gt;&gt; are<br clear="none"
 class="" style="">&gt;&gt; inserted in the working memory, I am deliberately advancing the Pseudo<br clear="none" class="" style="">&gt;&gt; clock<br clear="none" class="" style="">&gt;&gt; by<br clear="none" class="" style="">&gt;&gt; another 1 minute, so that the total time elapsed is 4 minutes. The rule<br clear="none" class="" style="">&gt;&gt; works<br clear="none" class="" style="">&gt;&gt; as expected with the above test setup and prints the average value as 26<br clear="none" class="" style="">&gt;&gt; on<br clear="none" class="" style="">&gt;&gt; the<br clear="none" class="" style="">&gt;&gt; console.<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; However,<br clear="none" class="" style="">&gt;&gt; if I advance the clock by 2 minutes instead of 1 minute after three sensor<br clear="none" class="" style="">&gt;&gt; reading objects have been inserted in the working memory (after every 1<br clear="none"
 class="" style="">&gt;&gt; minute<br clear="none" class="" style="">&gt;&gt; interval), the rule gets invoked but the average value gets changed to 27<br clear="none" class="" style="">&gt;&gt; (26 +<br clear="none" class="" style="">&gt;&gt; 28 / 2 == 27). Looks like the first temperature reading is getting ignored<br clear="none" class="" style="">&gt;&gt; by<br clear="none" class="" style="">&gt;&gt; the rule despite the fact that it falls well within the specified time<br clear="none" class="" style="">&gt;&gt; range<br clear="none" class="" style="">&gt;&gt; of<br clear="none" class="" style="">&gt;&gt; 5 minutes. Below is the snapshot of my test class:<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; publicclassTemperatureAlarmTest<br clear="none" class="" style="">&gt;&gt; {<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticKnowledgeBase
 kbase;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticStatefulKnowledgeSession ksession;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticKnowledgeRuntimeLogger logger;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticSessionPseudoClock clock;<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @BeforeClass<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicstaticvoidsetupKsession() {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // load up the<br clear="none" class="" style="">&gt;&gt; knowledge base<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 kbase= readKnowledgeBase();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ksession= readKnowldedeSession(kbase);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clock= ksession.getSessionClock();<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logger=<br clear="none" class="" style="">&gt;&gt; KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession,<br clear="none" class="" style="">&gt;&gt; "log/Errors",<br clear="none" class="" style="">&gt;&gt; 500);<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } catch(Throwable t) {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.printStackTrace();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; /**<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt; Create a new Stateful knowledge Session with a pseudo clock from the<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt; knowledge base<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @paramkbase<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @return<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *
 @throwsException<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  */<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatestaticStatefulKnowledgeSession readKnowldedeSession(<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KnowledgeBase kbase) throwsException {<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Knowledge Session Configuration<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeSessionConfiguration<br clear="none" class="" style="">&gt;&gt; config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  config.setOption(ClockTypeOption.get("pseudo"));<br clear="none" class=""
 style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  returnkbase.newStatefulKnowledgeSession(config, null);<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @AfterClass<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicstaticvoidcloseKsession() {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // load up the<br clear="none" class="" style="">&gt;&gt; knowledge base<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logger.close();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ksession.dispose();<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } catch(Throwable t) {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.printStackTrace();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @Test<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicvoidTemperatureAlarm1_Test() {<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Create Temperature list<br clear="none" class="" style="">&gt;&gt;&nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ArrayList&lt;SensorReading&gt;<br clear="none" class="" style="">&gt;&gt; tempMetrics = newArrayList&lt;SensorReading&gt;();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  doubletemp = 24.00;<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while(tempMetrics.size()<br clear="none" class="" style="">&gt;&gt; &lt; 3) {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempMetrics.add(newSensorReading(temp));<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp += 2;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
  System.out.println("Size of<br clear="none" class="" style="">&gt;&gt; tempMetrics List: "+tempMetrics.size()+"\n");<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("First Temp<br clear="none" class="" style="">&gt;&gt; reading: "+tempMetrics.get(0).getTemperature());<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Second Temp<br clear="none" class="" style="">&gt;&gt; reading: "+tempMetrics.get(1).getTemperature());<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Third Temp<br clear="none" class="" style="">&gt;&gt; reading: "+tempMetrics.get(2).getTemperature()+"\n");<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Separate stream for inserts<br clear="none" class=""
 style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  WorkingMemoryEntryPoint<br clear="none" class="" style="">&gt;&gt; temperatureStream = ksession.getWorkingMemoryEntryPoint( "Temperature<br clear="none" class="" style="">&gt;&gt; Reading");<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Create fact handle list<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ArrayList&lt;FactHandle&gt;<br clear="none" class="" style="">&gt;&gt; factHandleList = newArrayList&lt;FactHandle&gt;();<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Insert objects into working<br clear="none" class="" style="">&gt;&gt; memory while advancing the clock<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
 for(inti = 0; i &lt;<br clear="none" class="" style="">&gt;&gt; tempMetrics.size(); i++) {<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; factHandleList.add(temperatureStream.insert(tempMetrics.get(i)));<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clock.advanceTime(1,<br clear="none" class="" style="">&gt;&gt; TimeUnit.MINUTES);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Time advances<br clear="none" class="" style="">&gt;&gt; by 1 minute");<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fact Count<br clear="none" class="" style="">&gt;&gt; is: "+temperatureStream.getFactCount());<br
 clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fact Entry<br clear="none" class="" style="">&gt;&gt; Point is: "+temperatureStream.getEntryPointId());<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Size of<br clear="none" class="" style="">&gt;&gt; FactHandleList: "+factHandleList.size()+"\n");<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clock.advanceTime(1,<br clear="none" class="" style="">&gt;&gt; TimeUnit.MINUTES);&nbsp; &nbsp; &nbsp; &nbsp;  //change in<br clear="none" class="" style="">&gt;&gt; advanced time alters the rule behavior<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  StringBuilder stringBuilder = newStringBuilder();<br clear="none"
 class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ksession.setGlobal("alertMessage", stringBuilder);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ksession.fireAllRules();<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Remove facts<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for(inti = 0; i &lt;<br clear="none" class="" style="">&gt;&gt; factHandleList.size(); i++) {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temperatureStream.retract(factHandleList.get(i));<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("After<br
 clear="none" class="" style="">&gt;&gt; Removing facts");<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fact Count<br clear="none" class="" style="">&gt;&gt; is: "+temperatureStream.getFactCount());<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String result =<br clear="none" class="" style="">&gt;&gt; stringBuilder.substring(0, 32);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Alert Message<br clear="none" class="" style="">&gt;&gt; is: \n"+ stringBuilder.toString());<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  assertEquals("Alert Message<br clear="none" class="" style="">&gt;&gt; is: ", "Threshold<br clear="none" class="" style="">&gt;&gt; temperature breached!!", result);<br
 clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; /**<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt; Create the knowledge base with stream processing turned on.<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @return<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @throwsException<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  */<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatestaticKnowledgeBase<br clear="none" class="" style="">&gt;&gt; readKnowledgeBase() throwsException {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBuilder
 kbuilder =<br clear="none" class="" style="">&gt;&gt; KnowledgeBuilderFactory.newKnowledgeBuilder();<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; kbuilder.add(ResourceFactory.newClassPathResource("TemperatureAlarm1.drl"),ResourceType.DRL);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  hasErrors(kbuilder);<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Stream processing turned on<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBaseConfiguration conf =<br clear="none" class="" style="">&gt;&gt; KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  conf.setOption(EventProcessingOption.STREAM);<br clear="none" class=""
 style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBase kbase =<br clear="none" class="" style="">&gt;&gt; KnowledgeBaseFactory.newKnowledgeBase(conf);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  hasErrors(kbuilder);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  returnkbase;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; /**<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt; Report errors if any<br clear="none" class="" style="">&gt;&gt;&nbsp;
 &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @paramkbuilder<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @throwsException<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  */<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatestaticvoidhasErrors(KnowledgeBuilder kbuilder)<br clear="none" class="" style="">&gt;&gt; throwsException<br clear="none" class="" style="">&gt;&gt; {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBuilderErrors errors =<br clear="none" class="" style="">&gt;&gt; kbuilder.getErrors();<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(errors.size() &gt; 0) {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(KnowledgeBuilderError error :
 errors) {<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(error);<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; thrownewIllegalArgumentException("Could not parse<br clear="none" class="" style="">&gt;&gt; knowledge.");<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; }<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; Could<br
 clear="none" class="" style="">&gt;&gt; anyone please help explain this change in the behavior of the rule?<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; Regards,<br clear="none" class="" style="">&gt;&gt; Sushant<br clear="none" class="" style=""></div><br clear="none" class="" style=""><br clear="none" class="" style=""></div>  </div> </div>  </div></div> </div></div></div><br class="" style=""><br class="" style=""></div>  </div> </div>  </div> </div></body></html>