[rules-users] parametrized rules

Tim van Heugten stimme at gmail.com
Mon Apr 2 10:18:10 EDT 2012


Hi all,

I'm new to Drools, and wonder how I can most cleanly write down rules for
the following.

(For the sake of example) Say I have an object that needs to be processed
season-dependent. I basically need a rule like:
rule
    when
        Date( month == X, day >= Y, day <= Z)
        // Some date containing object
    then
        System.out.println("Season is "+R)
        // Store season in associated object
end

And fill in X, Y, Z and R with:
X    Y    Z    R
1    1    31    Winter
2    1    29    Winter
3    1    21    Winter
3    22    31    Spring
4    1    30    Spring
5    1    31    Spring
6    1    21    Spring
6    22    30    Summer
7    1    31    Summer
...


Should I expand all this rules by hand, and define 16 rules in my rule
file? Or can I parametrize the rules and have this done automagically?

Thanks a lot,

Tim van Heugten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120402/71dfd511/attachment.html 


More information about the rules-users mailing list