Any form of "groub by" or "distinct" in accumulate/collect ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Any form of "groub by" or "distinct" in accumulate/collect ?

Ephemeris Lappis
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.
Reply | Threaded
Open this post in threaded view
|

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

Jan Šťastný
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

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

Ephemeris Lappis
Hello.

It seems a quite good idea. On the way of "accumulate " or "collect",
I've been thinking before such a solution... Injection of the collected
elements remains to be done.
I will try it with a concrete data set and verify that the collection
time is acceptable.
I'll let you know about the results.
Thanks.
Regards.

Ephemeris Lappis

Le 10/05/2014 19:06, Jan Šťastný a écrit :

> 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
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/rules-users
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users