[rules-users] Re: Decision Table - Object equality example
Arjun Dhar
dhar_ar at yahoo.com
Mon Jul 23 13:06:58 EDT 2007
dpark <dpark <at> exchangesolutions.com> writes:
>
>
> I'm in the process of upgrading our decision table rules from 2.1 to 3.0.
> However I've run into a bit of a snag that I hope someone can help me with.
>
> We have a generalized consolidation rule that:
> * takes 2 parameters of the same Object Type
> * makes sure that they don't point to the same reference
> * makes sure a field is the same
> * and finally retracts one of the objects from working memory (and updates
> some statistics on the survivor object)
>
> It just seems a little fuzzy to me how I would write that in a DRL and a
> Decision Table.
> (I'm finding the decision table documentation and supplied example a little
> on the light side)
>
> Any sympathetic helpers out there?
Well this is how I get it done:
Object Model:
A {
B b;
valueSet;
}
B {
A a;
price;
}
Rule in Decision Table:
condition 1-- instanceOfA:A
valueSet==$1 or whatever you want
<values>
condition 2-- instanceOfB:B
a == instanceOfA
price == $1
<values>
The above reverse association in the object model will ensure that the rule is
executed for that object only. If you have multiple condiotions on "A" itself,
then use "this" e.g. 'secondInstanceOfA == this' :o)
regards,
Arjun
More information about the rules-users
mailing list