[rules-users] Evaluate rules for multiple facts of the same type within a StateuflSession
Wolfgang Laun
wolfgang.laun at gmail.com
Wed Feb 13 09:37:25 EST 2013
There's an interesting note to be made in addition to the Section
"Fact Classification" in the whitepaper.
class Param {
boolean creditcard;
Product product;
int discount, }
is easy enough to handle (with product == null to indicate no product test).
But what if you'd like to test for more than one product?
class Param {
boolean creditcard;
Set<Product> products;
int discount, }
The test for one set being a subset of another isn't the problem, but
now you can create Param instances that don't define mutually
exclusive cart values, e.g.:
Cart: true, {A, B, C}.
Param: true, {A}, 10
Param: true, {A, B}, 12
In this case you might, in the rule pairing off a Cart and a Param,
a) ensure that there is no other matching Param with a higher discount
b) use a salience expression based on discount
-W
On 13/02/2013, pdario <dario.piantanida at gmail.com> wrote:
> @ part was just for your remark on cumbersomeness...
>
> I'm now reading the linked whitepaper.
>
> It's not easy for me to see how your example is easier than mine solution.
>
> I acknowledge salience redistribution would be a problem, that's why I kept
> them separated and kept salience values meaningful only within each
> activation-group.
>
> At the moment, anyway, the activation-group is stopping me from evaluating
> rules for a bunch of facts in only one run, so I have to find a different
> solution (supposing that a multiple single fact activation is not
> efficient,
> something I'm not sure).
>
> I'll read the whitepaper and see if agenda-group would better fit in my
> case.
>
> Thank you all. :-)
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Evaluate-rules-for-multiple-facts-of-the-same-type-within-a-StateuflSession-tp4022157p4022276.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