[rules-users] Fwd: correlating two collects

Yuri de Wit ydewit at gmail.com
Thu Aug 2 07:10:22 EDT 2007


second try... (this is actually happenning too often)

---------- Forwarded message ----------
From: Yuri de Wit <ydewit at gmail.com>
Date: Aug 1, 2007 9:38 PM
Subject: correlating two collects
To: Rules Users List <rules-users at lists.jboss.org>


I am finally having some time to use collects. What I basically need
to do is to collect items from a list using a specific criteria, then
collect items from a diff list using another criteria, and finally
compare the groups collected using a 3rd criteria

Here is what I am thinking:

i : Item(type==A)
ig : ItemGroup(size>1)
         collect Item(a==i.a, b==i.b, ... n==i.n)

i2: Item(type==B)
ig2 : ItemGroup( size>1,
                         ga==ig.ga, gb==i.gb, .... )
         collect Item(a==i.a, b==i.b, ... n==i.n)

1) It is quite nice that any implementation of java.util.Collection
can be the resut of collect. ItemGroup here not only keeps hold of all
Items returned but has some aggregate properties (afaik, I cannot use
the aggregate functions with accumulate since I have multiple column
aggregation).

2) Am I on the right track? Or is there a better way?

3) Is the collect recomputed from scratch or incrementally every time
a new fact is asserted or updated?

thanks



More information about the rules-users mailing list