<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:10pt"><div class="" style="">Folks,<o:p class="" style=""></o:p></div><div class="" style=""><o:p class="" style="">&nbsp;</o:p></div><div class="" style="">



</div><div class="" style="">I have tried changing my Drools version to 5.5.0.Final and 6.0.1.Final,
but there is no change in the rule behavior. So, I assume we can rule out the
possibility of version issue.<o:p class="" style=""></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 4:04 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="yiv2217537400" 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 for&nbsp; your quick
response. </div><div class="" style="">I am using 5.3.0 Final version of Drools. Attached are the
necessary files (DRL, fact, test class) required to reproduce the effect.</div><div class="" style="">



</div><div class="" style="">Please let me know if any further details are required.</div><div class="" style="color:rgb(0, 0, 0);font-size:13px;font-family:'times new roman', 'new york', times, serif;font-style:normal;background-color:transparent;"><br clear="none" class="" style=""></div><div class="" style="color:rgb(0, 0, 0);font-size:13px;font-family:'times new roman', 'new york', times, serif;font-style:normal;background-color:transparent;">Thanks!</div> <div class="" style=""><br clear="none" class="" style=""><br clear="none" class="" style=""></div><div class="" id="yiv2217537400yqt19491" 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 2:23 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="">On first reading, both observations could be bugs. But it is difficult to<br clear="none" class="" style="">assess such situation without knowing the Drools version, without<br clear="none" class="" style="">having a complete (but minimal) set of Java and DRL code reproducing<br clear="none" class="" style="">the effect.<br clear="none" class="" style=""><br clear="none" class="" style="">-W<br clear="none" class="" style=""><div class="" id="yiv2217537400yqtfd10268" style=""><br clear="none" class="" style="">On 05/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 again for your response Wolfgang.<br clear="none" class="" style="">&gt;<br
 clear="none" class="" style="">&gt; I found one of the explanations on how
 Sliding Windows<br clear="none" class="" style="">&gt; operate in Drools while searching for an answer:<br clear="none" class="" style="">&gt; "Events are expired<br clear="none" class="" style="">&gt; from the time window when the clock advances"<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; So, in my case if I am inserting events on T0 (insert 1st event), T1 (insert<br clear="none" class="" style="">&gt; 2nd event), T2 (insert 3rd event) and<br clear="none" class="" style="">&gt; advancing the clock to T3, T4 and T5; 1st event inserted at T0 is<br clear="none" class="" style="">&gt; expired from the window. And the rule calculates the average of the last two<br clear="none" class="" style="">&gt; events (2nd event &amp; 3rd event) falling in the time<br clear="none" class="" style="">&gt; window. And the output average calculated by the from accumulate function<br clear="none" class="" style="">&gt; comes<br
 clear="none" class="" style="">&gt; to be (26 +28 / 2 == 27) satisfying the contract of average temperature to<br clear="none" class="" style="">&gt; be above<br clear="none" class="" style="">&gt; the threshold value of 25.<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; Now let's say I do the below (advancing the clock by 5<br clear="none" class="" style="">&gt; minutes after the 3rd insert):<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; T0 (insert 1st event)<br clear="none" class="" style="">&gt; T1 (insert 2st event)<br clear="none" class="" style="">&gt; T2 (insert 3st event)<br clear="none" class="" style="">&gt; T3<br clear="none" class="" style="">&gt; T4<br clear="none" class="" style="">&gt; T5<br clear="none" class="" style="">&gt; T6<br clear="none" class="" style="">&gt; T7<br clear="none" class="" style="">&gt; Fire all rules<br clear="none" class="" style="">&gt;<br
 clear="none" class="" style="">&gt; The average calculated by the rule is zero (0) since the<br clear="none" class="" style="">&gt; three inserted events fall outside the time window of 5 minutes (as<br clear="none" class="" style="">&gt; expected).<br clear="none" class="" style="">&gt; But, my rule fires regardless of the fact I have the contract of average<br clear="none" class="" style="">&gt; temperature<br clear="none" class="" style="">&gt; to be greater than threshold in my rule :<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; $averageTemp : Number(intValue<br clear="none" class="" style="">&gt;&gt; 25)<br clear="none" class="" style="">&gt;&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<br clear="none" class="" style="">&gt; accumulate(SensorReading($temp : temperature)<br clear="none"
 class="" style="">&gt;&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<br clear="none" class="" style="">&gt; window:time(5m) from<br clear="none" class="" style="">&gt; entry-point "Temperature Reading", average($temp))<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; As per the drools-fusion documentation, over window : time(X) is used to<br clear="none" class="" style="">&gt; consider events that happened in<br clear="none" class="" style="">&gt; the last X units. So, is there something that needs to be changed in my rule<br clear="none" class="" style="">&gt; implementation?<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; One more question here, does over window : time(X) really considers events<br clear="none"
 class="" style="">&gt; occurred in the last<br clear="none" class="" style="">&gt; X units. I tried going further by doing the below:<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; T0 (insert 1st event - Sensor reading is 24)<br clear="none" class="" style="">&gt; T1 (insert 2st event - Sensor reading is 26)<br clear="none" class="" style="">&gt; T2 (insert 3st event - Sensor reading is 28)<br clear="none" class="" style="">&gt; T3<br clear="none" class="" style="">&gt; T4<br clear="none" class="" style="">&gt; T5<br clear="none" class="" style="">&gt; T6<br clear="none" class="" style="">&gt; T7<br clear="none" class="" style="">&gt; (insert event - Sensor reading is 30)<br clear="none" class="" style="">&gt; Fire All rules<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; With the above test setup, my rule gets invoked twice printing<br clear="none" class="" style="">&gt; the average of
 temperatures as (30) and (30). But using over window:time(5m)<br clear="none" class="" style="">&gt; shouldn't result in rule being triggered once ?<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; Thanks in advance!<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt;<br clear="none" class="" style="">&gt; On Thursday, 5 June 2014 12:31 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; Computations involving intervals where events arrive in real time<br clear="none" class="" style="">&gt; should not depend on
 differences of one unit of the smalles
 unit of<br clear="none" class="" style="">&gt; time for specifying durations (here: milliseconds).<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;<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; Thanks for your response.<br clear="none" class="" style="">&gt;&gt; I was under the assumption that the window time frame begins, the moment<br clear="none" class="" style="">&gt;&gt; first event is inserted into the working memory. Or I am still missing out<br clear="none" class="" style="">&gt;&gt; something here (when
 you say that the first event is
 exactly at the<br clear="none" class="" style="">&gt;&gt; beginning of the window)?&nbsp; If I traverse backwards as below, then<br clear="none" class="" style="">&gt;&gt; definitely<br clear="none" class="" style="">&gt;&gt; the 1st event lies outside the window.<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&nbsp;  insert 1st event<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay 1 minute ^&nbsp; (4 + 1 = 5)<br clear="none" class="" style="">&gt;&gt;&nbsp;  insert 2nd event<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay 1 minute&nbsp; ^ (3 + 1 = 4)<br clear="none" class="" style="">&gt;&gt;&nbsp;  insert 3rd event<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay 1 minute&nbsp;  ^ (2 + 1 = 3)<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay 2 minutes&nbsp; ^<br clear="none" class="" style="">&gt;&gt;&nbsp;  fire all rules<br clear="none" class="" style="">&gt;&gt;<br clear="none"
 class="" style="">&gt;&gt; However, if I start from the 1st event, the possibility where 1st event<br clear="none" class="" style="">&gt;&gt; lies<br clear="none" class="" style="">&gt;&gt; out of time frame of 5 mins would be if certain amount of time is<br clear="none" class="" style="">&gt;&gt; consumed while inserting the 1st event. I tried to check it<br clear="none" class="" style="">&gt;&gt; programmatically<br clear="none" class="" style="">&gt;&gt; to see if there is any time lapsed during the insertion of the event by<br clear="none" class="" style="">&gt;&gt; printing the clock's current time using clock.getCurrentTime() method<br clear="none" class="" style="">&gt;&gt; before<br clear="none" class="" style="">&gt;&gt; and after inserting the 1st event, however, could not notice any<br clear="none" class="" style="">&gt;&gt; difference.<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; But, if I change the
 time to be advanced by 1 minutes and 59 seconds<br clear="none" class="" style="">&gt;&gt; (instead of 2 minutes) towards the end after the three events have been<br clear="none" class="" style="">&gt;&gt; inserted, the rule seems to be working fine by considering all the three<br clear="none" class="" style="">&gt;&gt; events for calculating the average.<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; I know I am definitely missing out something here as I can see the<br clear="none" class="" style="">&gt;&gt; difference in the behavior of the rule by merely reducing the total delay<br clear="none" class="" style="">&gt;&gt; in<br clear="none" class="" style="">&gt;&gt; time by 1 second (4 min 59 sec instead of 5 minutes) as stated above. But<br clear="none" class="" style="">&gt;&gt; I<br clear="none" class="" style="">&gt;&gt; am not able to figure that out.<br clear="none" class="" style="">&gt;&gt;<br
 clear="none" class="" style="">&gt;&gt; Could you please provide more insight.<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; Thanks!<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&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;&gt; wrote:<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; Your code does:<br clear="none" class="" style="">&gt;&gt;&nbsp;  insert 1st event<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay 1 minute<br clear="none" class="" style="">&gt;&gt;&nbsp;  insert 2nd
 event<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay 1 minute<br clear="none" class="" style="">&gt;&gt;&nbsp;  insert 3rd event<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay 1 minute<br clear="none" class="" style="">&gt;&gt;&nbsp;  delay (1 or) 2 minutes<br clear="none" class="" style="">&gt;&gt;&nbsp;  fire all rules<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; In the second case, 5 minutes have elapsed since the 1st insert. I<br clear="none" class="" style="">&gt;&gt; don't think that this means "that [the 1st insert] falls well within<br clear="none" class="" style="">&gt;&gt; the specified time range" - it is exactly at the beginning of the<br clear="none" class="" style="">&gt;&gt; window, and I'd expect the window to be an interval open at one end -<br clear="none" class="" style="">&gt;&gt; otherwise events smack on the point in time "separating" two intervals<br clear="none" class=""
 style="">&gt;&gt; would be in
 both windows.<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt; -W<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&gt;<br clear="none" class="" style="">&gt;&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;&gt; Hi,<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; I am<br clear="none" class="" style="">&gt;&gt;&gt; trying to understand how Drools can be used to monitor events over a<br clear="none" class="" style="">&gt;&gt;&gt; period<br clear="none" class="" style="">&gt;&gt;&gt; of<br clear="none" class="" style="">&gt;&gt;&gt; time using Sliding Time Windows. I have created a rule to sound an alarm<br clear="none"
 class="" style="">&gt;&gt;&gt;
 when<br clear="none" class="" style="">&gt;&gt;&gt; average temperature read from a sensor is above 25 degrees (threshold)<br clear="none" class="" style="">&gt;&gt;&gt; over<br clear="none" class="" style="">&gt;&gt;&gt; a<br clear="none" class="" style="">&gt;&gt;&gt; time period of 5 minutes. The rule makes of use of the Stream processing<br clear="none" class="" style="">&gt;&gt;&gt; mode so<br clear="none" class="" style="">&gt;&gt;&gt; that continuous stream of events could be processed.<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; Below<br clear="none" class="" style="">&gt;&gt;&gt; is how my rule looks like:<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; //declare any global<br clear="none" class="" style="">&gt;&gt;&gt; variables here<br clear="none" class="" style="">&gt;&gt;&gt; globaljava.lang.StringBuilder alertMessage<br clear="none" class=""
 style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; // add declaration to<br clear="none" class="" style="">&gt;&gt;&gt; change the Fact into an Event<br clear="none" class="" style="">&gt;&gt;&gt; declareSensorReading<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @role(event)<br clear="none" class="" style="">&gt;&gt;&gt; end<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; /* Alert when average<br clear="none" class="" style="">&gt;&gt;&gt; temperature is above 25<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; over a time period of 5 minutes */<br clear="none" class="" style="">&gt;&gt;&gt; rule"TemperatureAlarm1"<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp;  when<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  //conditions<br clear="none" class=""
 style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  $averageTemp : Number(doubleValue &gt;<br clear="none" class="" style="">&gt;&gt;&gt; 25.00)<br clear="none" class="" style="">&gt;&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;&gt; : temperature)<br clear="none" class="" style="">&gt;&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;&gt; window:time(5m) fromentry-point "Temperature Reading", average($temp))<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp;  then<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  //actions<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fired rule:<br clear="none" class=""
 style="">&gt;&gt;&gt; "+<br clear="none" class="" style="">&gt;&gt;&gt; kcontext.getRule().getName());<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  alertMessage.append("Threshold<br clear="none" class="" style="">&gt;&gt;&gt; temperature breached!!"+<br clear="none" class="" style="">&gt;&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;&gt; Air Conditioner"+<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "\nAverage<br clear="none" class="" style="">&gt;&gt;&gt; temperature over 5 minutes is above 25 ("+ $averageTemp.intValue() +<br clear="none" class="" style="">&gt;&gt;&gt; ")\n");<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; end<br clear="none" class=""
 style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; And below<br clear="none" class="" style="">&gt;&gt;&gt; is the snapshot of the fact (SensorReading) which is inserted as an event<br clear="none" class="" style="">&gt;&gt;&gt; in<br clear="none" class="" style="">&gt;&gt;&gt; the working memory:<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; publicclassSensorReading {<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatedoubletemperature;<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicSensorReading(){}<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicSensorReading(doubletemp){<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp;  this.temperature= temp;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; // getters and setters<br clear="none" class="" style="">&gt;&gt;&gt; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; In<br clear="none" class="" style="">&gt;&gt;&gt; order to test the rule, I am using Pseudo Clock with Stream processing<br clear="none" class="" style="">&gt;&gt;&gt; turned<br clear="none" class="" style="">&gt;&gt;&gt; on. I am inserting three SensorReading objects in the working memory with<br clear="none" class="" style="">&gt;&gt;&gt; temperature<br clear="none" class="" style="">&gt;&gt;&gt; values as (24, 26, 28) after every minute, so that the average of the<br clear="none" class="" style="">&gt;&gt;&gt;
 temperatures is above threshold and the rule is invoked. After the<br clear="none" class="" style="">&gt;&gt;&gt; objects<br clear="none" class="" style="">&gt;&gt;&gt; are<br clear="none" class="" style="">&gt;&gt;&gt; inserted in the working memory, I am deliberately advancing the Pseudo<br clear="none" class="" style="">&gt;&gt;&gt; clock<br clear="none" class="" style="">&gt;&gt;&gt; by<br clear="none" class="" style="">&gt;&gt;&gt; another 1 minute, so that the total time elapsed is 4 minutes. The rule<br clear="none" class="" style="">&gt;&gt;&gt; works<br clear="none" class="" style="">&gt;&gt;&gt; as expected with the above test setup and prints the average value as 26<br clear="none" class="" style="">&gt;&gt;&gt; on<br clear="none" class="" style="">&gt;&gt;&gt; the<br clear="none" class="" style="">&gt;&gt;&gt; console.<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; However,<br clear="none"
 class="" style="">&gt;&gt;&gt; if I advance the clock by 2 minutes instead of 1 minute after three<br clear="none" class="" style="">&gt;&gt;&gt; sensor<br clear="none" class="" style="">&gt;&gt;&gt; reading objects have been inserted in the working memory (after every 1<br clear="none" class="" style="">&gt;&gt;&gt; minute<br clear="none" class="" style="">&gt;&gt;&gt; interval), the rule gets invoked but the average value gets changed to 27<br clear="none" class="" style="">&gt;&gt;&gt; (26 +<br clear="none" class="" style="">&gt;&gt;&gt; 28 / 2 == 27). Looks like the first temperature reading is getting<br clear="none" class="" style="">&gt;&gt;&gt; ignored<br clear="none" class="" style="">&gt;&gt;&gt; by<br clear="none" class="" style="">&gt;&gt;&gt; the rule despite the fact that it falls well within the specified time<br clear="none" class="" style="">&gt;&gt;&gt; range<br clear="none" class="" style="">&gt;&gt;&gt; of<br clear="none" class=""
 style="">&gt;&gt;&gt; 5 minutes. Below is the snapshot of my test class:<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; publicclassTemperatureAlarmTest<br clear="none" class="" style="">&gt;&gt;&gt; {<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticKnowledgeBase kbase;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticStatefulKnowledgeSession ksession;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticKnowledgeRuntimeLogger logger;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; staticSessionPseudoClock clock;<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @BeforeClass<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicstaticvoidsetupKsession()
 {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // load up the<br clear="none" class="" style="">&gt;&gt;&gt; knowledge base<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kbase= readKnowledgeBase();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ksession= readKnowldedeSession(kbase);<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clock= ksession.getSessionClock();<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logger=<br clear="none"
 class="" style="">&gt;&gt;&gt; KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession,<br clear="none" class="" style="">&gt;&gt;&gt; "log/Errors",<br clear="none" class="" style="">&gt;&gt;&gt; 500);<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } catch(Throwable t) {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.printStackTrace();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; /**<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&gt; Create a new Stateful
 knowledge Session with a pseudo clock from the<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&gt; knowledge base<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @paramkbase<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @return<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @throwsException<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  */<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatestaticStatefulKnowledgeSession readKnowldedeSession(<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KnowledgeBase kbase) throwsException {<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none"
 class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Knowledge Session Configuration<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeSessionConfiguration<br clear="none" class="" style="">&gt;&gt;&gt; config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  config.setOption(ClockTypeOption.get("pseudo"));<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  returnkbase.newStatefulKnowledgeSession(config, null);<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @AfterClass<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp;
 &nbsp; &nbsp; publicstaticvoidcloseKsession() {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // load up the<br clear="none" class="" style="">&gt;&gt;&gt; knowledge base<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logger.close();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ksession.dispose();<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } catch(Throwable t) {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.printStackTrace();<br clear="none" class=""
 style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; @Test<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; publicvoidTemperatureAlarm1_Test() {<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Create Temperature list<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ArrayList&lt;SensorReading&gt;<br clear="none" class="" style="">&gt;&gt;&gt; tempMetrics = newArrayList&lt;SensorReading&gt;();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  doubletemp = 24.00;<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none"
 class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while(tempMetrics.size()<br clear="none" class="" style="">&gt;&gt;&gt; &lt; 3) {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempMetrics.add(newSensorReading(temp));<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp += 2;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Size of<br clear="none" class="" style="">&gt;&gt;&gt; tempMetrics List: "+tempMetrics.size()+"\n");<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("First Temp<br clear="none" class="" style="">&gt;&gt;&gt; reading:
 "+tempMetrics.get(0).getTemperature());<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Second Temp<br clear="none" class="" style="">&gt;&gt;&gt; reading: "+tempMetrics.get(1).getTemperature());<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Third Temp<br clear="none" class="" style="">&gt;&gt;&gt; reading: "+tempMetrics.get(2).getTemperature()+"\n");<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Separate stream for inserts<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  WorkingMemoryEntryPoint<br clear="none" class="" style="">&gt;&gt;&gt; temperatureStream = ksession.getWorkingMemoryEntryPoint( "Temperature<br clear="none" class="" style="">&gt;&gt;&gt; Reading");<br
 clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Create fact handle list<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ArrayList&lt;FactHandle&gt;<br clear="none" class="" style="">&gt;&gt;&gt; factHandleList = newArrayList&lt;FactHandle&gt;();<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Insert objects into working<br clear="none" class="" style="">&gt;&gt;&gt; memory while advancing the clock<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for(inti = 0; i &lt;<br clear="none" class="" style="">&gt;&gt;&gt; tempMetrics.size(); i++) {<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;
 factHandleList.add(temperatureStream.insert(tempMetrics.get(i)));<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clock.advanceTime(1,<br clear="none" class="" style="">&gt;&gt;&gt; TimeUnit.MINUTES);<br clear="none" class="" style="">&gt;&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;&gt; by 1 minute");<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fact Count<br clear="none" class="" style="">&gt;&gt;&gt; is: "+temperatureStream.getFactCount());<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fact Entry<br clear="none" class=""
 style="">&gt;&gt;&gt; Point is: "+temperatureStream.getEntryPointId());<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Size of<br clear="none" class="" style="">&gt;&gt;&gt; FactHandleList: "+factHandleList.size()+"\n");<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  clock.advanceTime(1,<br clear="none" class="" style="">&gt;&gt;&gt; TimeUnit.MINUTES);&nbsp; &nbsp; &nbsp; &nbsp;  //change in<br clear="none" class="" style="">&gt;&gt;&gt; advanced time alters the rule behavior<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  StringBuilder stringBuilder = newStringBuilder();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
 ksession.setGlobal("alertMessage", stringBuilder);<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ksession.fireAllRules();<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Remove facts<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for(inti = 0; i &lt;<br clear="none" class="" style="">&gt;&gt;&gt; factHandleList.size(); i++) {<br clear="none" class="" style="">&gt;&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;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("After<br clear="none" class="" style="">&gt;&gt;&gt;
 Removing facts");<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Fact Count<br clear="none" class="" style="">&gt;&gt;&gt; is: "+temperatureStream.getFactCount());<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String result =<br clear="none" class="" style="">&gt;&gt;&gt; stringBuilder.substring(0, 32);<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println("Alert Message<br clear="none" class="" style="">&gt;&gt;&gt; is: \n"+ stringBuilder.toString());<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  assertEquals("Alert Message<br clear="none" class="" style="">&gt;&gt;&gt; is: ", "Threshold<br clear="none" class="" style="">&gt;&gt;&gt; temperature breached!!", result);<br
 clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; /**<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&gt; Create the knowledge base with stream processing turned on.<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @return<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @throwsException<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  */<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatestaticKnowledgeBase<br clear="none" class="" style="">&gt;&gt;&gt; readKnowledgeBase() throwsException {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBuilder kbuilder =<br clear="none" class="" style="">&gt;&gt;&gt; KnowledgeBuilderFactory.newKnowledgeBuilder();<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; kbuilder.add(ResourceFactory.newClassPathResource("TemperatureAlarm1.drl"),ResourceType.DRL);<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  hasErrors(kbuilder);<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Stream processing turned on<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBaseConfiguration conf =<br clear="none" class="" style="">&gt;&gt;&gt; KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
 conf.setOption(EventProcessingOption.STREAM);<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBase kbase =<br clear="none" class="" style="">&gt;&gt;&gt; KnowledgeBaseFactory.newKnowledgeBase(conf);<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  hasErrors(kbuilder);<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  returnkbase;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; /**<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br
 clear="none" class="" style="">&gt;&gt;&gt; Report errors if any<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  *<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @paramkbuilder<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  * @throwsException<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;  */<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; privatestaticvoidhasErrors(KnowledgeBuilder kbuilder)<br clear="none" class="" style="">&gt;&gt;&gt; throwsException<br clear="none" class="" style="">&gt;&gt;&gt; {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  KnowledgeBuilderErrors errors =<br clear="none" class="" style="">&gt;&gt;&gt; kbuilder.getErrors();<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(errors.size() &gt; 0)
 {<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(KnowledgeBuilderError error : errors) {<br clear="none" class="" style="">&gt;&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;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; thrownewIllegalArgumentException("Could not parse<br clear="none" class="" style="">&gt;&gt;&gt; knowledge.");<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp; }<br clear="none" class=""
 style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; }<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; Could<br clear="none" class="" style="">&gt;&gt;&gt; anyone please help explain this change in the behavior of the rule?<br clear="none" class="" style="">&gt;&gt;&gt;<br clear="none" class="" style="">&gt;&gt;&gt; Regards,<br clear="none" class="" style="">&gt;&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=""><div class="" id="yqt86189" style="">_______________________________________________<br clear="none" class="" style="">rules-users mailing list<br clear="none" class="" style=""><a shape="rect" ymailto="mailto:rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org" class=""
 style="">rules-users@lists.jboss.org</a><br clear="none" class="" style=""><a shape="rect" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" class="" style="">https://lists.jboss.org/mailman/listinfo/rules-users</a></div><br class="" style=""><br class="" style=""></div>  </div> </div>  </div> </div></body></html>