[rules-users] 答复: Many to many matching using Drools rules

Zhuo Li milanello1998 at gmail.com
Wed Dec 14 07:23:34 EST 2011


Yep, this was what I was thinking but in that case I rely more on the
pairing algorithm I gave - might be in java function - rather than drools'
rules and advantage of RETE. There are many algorithms can resolve my
problem and I can implement them in java, but that has nothing to do with
drools or rules. I was wondering if Drools provide any natural way to
resolve this problem within its own rule but seems no luck so far.

Best
Abe

-----邮件原件-----
发件人: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] 代表 Wolfgang Laun
发送时间: 2011年12月14日 15:02
收件人: Rules Users List
主题: Re: [rules-users] Many to many matching using Drools rules

You can collect objects of both classes with matching id and date.
Each of these collected objects has the original id and date a list of
amount figures.

Pairing the collected object from repository and accounting is simple.
Then, you'll have to implement an algorith that selects the items from
both sides in an acceptable way. I presume that one or more items from
one side must exactly be equal to one or more items from the other
side, which may not always be possible even though there would be
"coverage" of an item of one side by items on the other side (e.g.
7,11 vs.3,3,3,3).

But assuming that you detect matching sums, you retract the original
facts. In any case, the collected objects must be retracted, too, at
the end of the processing.

(Some details depend on the way the original facts are inserted.)

HTH
-W






On 14/12/2011, Zhuo LI <milanello1998 at gmail.com> wrote:
> i want to find txns from both sides whose portfolio asset and sum of amt
> are the same.
>
> 在 2011-12-14 上午9:18,"Salaboy" <salaboy at gmail.com>写道:
>
>> Do you want to compare to set of transactions to find which of them are
in
>> both sets and which of them are not?
>> Is that what are you trying to achieve?
>> Cheers
>>
>> - CTO @ http://www.plugtree.com
>> - MyJourney @ http://salaboy.wordpress.com
>> - Co-Founder @ http://www.jbug.com.ar
>> - Mauricio "Salaboy" Salatino -
>>
>> On 13/12/2011, at 10:27, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:
>>
>> > Huh?
>> > -W
>> >
>> > 2011/12/13 Zhuo Li <milanello1998 at gmail.com>:
>> >> Folks,
>> >>
>> >>
>> >>
>> >> I am recently working on a BI project which is doing reconciliation
>> between
>> >> repository and accounting. I'm using Drools 5.1.1 to maintain all
these
>> >> matching rules. One scenario I have no clue to implement in Drools is
>> that I
>> >> need to find x transactions from repository, to match y transactions
>> from
>> >> accounting, while existing repository transactions and accounting
>> >> transactions are bigger than x and y. Does anybody have experience to
>> >> do
>> >> similar thing in Drools?
>> >>
>> >>
>> >>
>> >> Best Abe
>> >>
>> >>
>> >> _______________________________________________
>> >> rules-users mailing list
>> >> rules-users at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>

_______________________________________________
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