First time around I also stumbled over this, especially because the documention fails to describe the actual behaviour, which is certainly not intuitive. All uses of "length n" that I know *do not* include things of length n-1, n-2,... 1. Imagine going into a shop and asking for a belt of length 60" and getting one of 12". A Java array of length 10 isn't 3 or 5 or 9 elements long. Many mathematical procedures that use a data window of length n must avoid shorter samples, or use different treatment, e.g., an initial value problem, or statistical evaluation.
-W On 18 October 2011 23:33, Mark Proctor <[email protected]> wrote: > Think about the logic you have written. > > length(3) does not mean that it must have 3, but that it is the last > three. So it could be 0, 1, 2 or 3 in length. > > As soon s you have 1, 2, or 3 insertions if any one of those creates an > average of > 30 the rule fires. > > So you are inserting a ZZZBean that creates an average, even if it's an > average with a count of 1, over 30. > > Mark > On 18/10/2011 07:20, eskomk wrote: > > Hi all, > > > > Here is the rule: > > > > CLIP --> > > rule "ZZZOver30" dialect "mvel" > > > > when > > $tsb : ZZZBean($prof : profileID) > > $avg : Number( doubleValue> 30 ) from accumulate( > > ZZZBean( $tempr : temperature, profileID == $prof) over > > window:length( 3 ), > > average( $tempr ) ) > > then > > // do something > > end > > CLIP<-- > > > > The intention as you can see is that the rule fires if the average > > temperature rises above 30 degrees (of Celsius) in some measuring period. > > For testing purposes the rule takes a specific number of temperatures > > (window:length), in production environment the window will be time > > (window:time(Xm)). > > > > My question is, why this rule fires immediately after drools-expert is > > started ? > > Is there something wrong in syntax ? > > > > In startup there are obviously no objects of this kind (ZZZBean) in > Working > > Set's memory, so it really shouldn't fire. > > > > We are running Drools ver. 5.1.1 as a web service on top of apache, and > the > > facts (events) are fed to Drools via REST interface as XML. > > > > thanks and regards, > > Esko > > ----- > > Esko Hujanen > > www.ebsolut.fi > > > > > > -- > > View this message in context: > http://drools.46999.n3.nabble.com/Why-this-rule-fires-immediately-tp3430427p3430427.html > > Sent from the Drools: User forum mailing list archive at Nabble.com. > > _______________________________________________ > > rules-users mailing list > > [email protected] > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
