Seems that there is a confusion here ...
window:length(X) is constraining the events timestamps to be in a time-windows of length X
(in seconds).
To contrain the number of accumulated facts, it must be done by adding a constraint in the
resulting list :
$list : ArrayList(size > Nb) from accumulate(Class1($a:a) over window:length(X) from
entry-point "Point" ...
@wolfgang : if you use an internal counter in the accumulate, how can you test it
internaly ? return empty (or null) list if max not reached ?
$list : ArrayList() from accumulate($obj : Class1($a:a) over window:length(X) from
entry-point "Point"
init ( ArrayList list = new ArrayList(); ),
action ( list.add($obj); ),
return ( if (list.size() < Nb {return null;} else {return
list;} ))
----- Mail original -----
De: "Wolfgang Laun" <wolfgang.laun(a)gmail.com>
À: "Rules Users List" <rules-users(a)lists.jboss.org>
Envoyé: Mercredi 16 Mai 2012 13:02:46
Objet: Re: [rules-users] Evaluation of the of rules with 'window:length' event
windows
Accumulate the count of elements (in addition to whatever you
accumulate) and test the result as being == X. As of (IIRC) 5.3.0, you
can write multi-function accumulates.
-W
On 16/05/2012, senyatur <senya.touretski(a)emc.com> wrote:
Hi guys
We are using Drools for event processing. So we have rules that, for
instance, put accumulation function over window of number of elements (not
time).
... from accumulate(Class1($a:a) over window:length(X) from entry-point
"Point"...
The problem we are experiencing that when evaluating the rule when there
are
*less* elements than X (window length) the accumulation function is still
calculated which leads to wrong results.
Is there a way in Drools to restrict firing of this type of rules when
there
are less than 'length' elements in the session?
Thanks
--
View this message in context:
http://drools.46999.n3.nabble.com/Evaluation-of-the-of-rules-with-window-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users