[jboss-jira] [JBoss JIRA] (DROOLS-591) "not" and "accumulate" ordering LHS yield different counting
Matteo Mortari (JIRA)
issues at jboss.org
Thu Sep 4 05:45:59 EDT 2014
[ https://issues.jboss.org/browse/DROOLS-591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998764#comment-12998764 ]
Matteo Mortari commented on DROOLS-591:
---------------------------------------
I think this was due to some spurious cache or spurious .class which should have refreshed but in fact, they did not. Issuing a Eclipse > Clean and mvn clean, surprisingly, solved the issue. Can you kindly close the JIRA, please.
I discovered this as I was "collecting all the clearance at the Customs" by replacing product branding with another fantasy name, this made me discover one drl file was missing in the stripped-down code version I was about to share, and once solved the test did, indeed, passed with the fantasy-name stripped-down code version. So I went back to the original-name stripped-down code version which I had ready on hand when I raised the jira yerstarday, I issued Cleans everywhere, put the missing drl file as well, test did indeed passed also with the original-name stripped-down code version.
> The only explanation I can give myself, besides some embarrassment, is that some spurious cache or spurious .class was out-of-sync.
I'm really, really, sorry for the noise; but honestly, I could not expect this to be solved by simply issuing a clean.
> "not" and "accumulate" ordering LHS yield different counting
> ------------------------------------------------------------
>
> Key: DROOLS-591
> URL: https://issues.jboss.org/browse/DROOLS-591
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 6.1.0.Final
> Reporter: Matteo Mortari
> Assignee: Mark Proctor
>
> Ref. original post in Drools-Usage
> https://groups.google.com/d/msg/drools-usage/ETkH7gn3YwY/Fc46KqqkN9QJ
> h5. excerpt of original post
> I'm experiencing a very weird behavior of using "not" and "accumulate", their ordering in LHS yield different counting results. I can provide privately a reproducer because this happens only when several rules are deployed - the other rules do NOT interact over the same objects in memory, except from queries.
> The example knowledge base below, the goal is to detect spikes in temperature (integers) over the last 5m, and raise/clear an Alert accordingly. The unit test prove that when either of the rules "Trending Alert" or "Trending Clear" fires, the content of $myList if compared to the $myList coming from the third rule, is the SAME, because indeed just collecting over the same over window:time(5m)
> However, here is the odd behavior, when I also deploy the full kb:
> * If I leave "Trending Alert" this way, the content of $myList when the rule fire, actually extend beyond the 5m sliding window, in fact keeping track of 20m, 30m old samples, therefore yielding wrong results
> * If I reorder "Trending Alert" LHS to have the not Alert ( condition == "TEMPERATURE_TRENDING") to appear before the accumulate, the content of $myList when the rule fire is correct.
> * If I leave "Trending Alert" this way, and I remove other .drl files, the content of $myList when the rule fire is correct.
> Thanks
> {code}
> rule "Trending Alert"
> no-loop
> when
> accumulate( $cc : AirSurveyTemp ($temp : TheTemp ) over window:time(5m) ;
> $myList : collectList($cc),
> $number : count($cc),
> $min : min($temp),
> $max : max($temp) ;
> $max-$min > 10 )
> $oWhere : Measurement( id == "Inhabited area", val == "False" )
> not Alert ( condition == "TEMPERATURE_TRENDING")
> then
> Alert a = new Alert();
> a.setCondition("TEMPERATURE_TRENDING");
> System.out.println("++ Temperature Trending - " + a.getCondition() + " - Number of Object: " + $number + " - Min Value = " + $min + " - Max Value: " + $max );
> insert(a);
> alert.clear();
> alert.addAll($myList);
> end
>
> rule "Trending Clear"
> no-loop
> when
> $a : Alert(condition == "TEMPERATURE_TRENDING")
> accumulate( $cc : AirSurveyTemp ($temp : TheTemp ) over window:time(5m) ;
> $myList : collectList($cc),
> $number : count($cc),
> $min : min($temp),
> $max : max($temp) ;
> $max-$min < 11 )
> then
> System.out.println("-- Clear Alert "+ $a.getCondition() + "Number of Object: " + " - Number of Object: " + $number + " - Min Value = " + $min + " - Max Value: " + $max );
> retract($a);
> clear.clear();
> clear.addAll($myList);
> end
> rule "Trending Sampling window 5m"
> salience 1
> no-loop
> when
> accumulate( $cc : AirSurveyTemp ($temp : TheTemp ) over window:time(5m) ;
> $myList : collectList($cc),
> $number : count($cc),
> $min : min($temp),
> $max : max($temp)
> )
> then
> sampling.clear();
> sampling.addAll($myList);
> end
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
More information about the jboss-jira
mailing list