[rules-users] Any form of "groub by" or "distinct" in accumulate/collect ?

Jan Šťastný newohybat at gmail.com
Sat May 10 13:06:31 EDT 2014


Hi,
maybe I misunderstood you, but what about a set collection. Just 
implementd equals method of A properly and use accumulate function 
collectList
when
     accumulate(
         C(
             $a:b.a
         )
         , $uniqueASet:collectSet($a)
     )
then
     do whatever you want

Hope that helped.
Jan

Dne 10.5.2014 11:36, Ephemeris Lappis napsal(a):
> Hello.
>
> Perhaps that my question has few sense or none...
>
> I've an object graph with say A, B and C.
> A has one or many B, that has one or many C.
>
> I can navigate through the relations between my objects in both direction.
> For example, I can do fo any instance of C : c.b.a (or c.getB().getA())...
>
> My initial input facts or only C objects, and I'd like to identify all the
> distinct A instances, and insert them into my working memory, as they
> participate to global rules.
>
> I've been looking for some forms of accumulate or collect, but I've not
> found a correct way to do it.
>
> Some help ?
>
> Thanks
>
> Regards.
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Any-form-of-groub-by-or-distinct-in-accumulate-collect-tp4029501.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list