[rules-users] externalization of input constraints in a rule
Michael Anstis
michael.anstis at gmail.com
Thu Oct 20 03:49:48 EDT 2011
The same principle applies, but instead of inserting a single SSN container,
you insert a generic "parameters" container:-
rule "rule 1"
when
Parameters( rule == "rule 1", $ssn : ssn, $citizenship : citizenship )
Person( ssn = $ssn, citizenship == $citizenship )
then
....
If your parameters are more generic Parameters could contain a Map instead
of explicit parameters and change the Person pattern accordingly.
It'd be good to be able to extract the rule name in the LHS, but I don't
think this is possible (anybody?)
Cheers,
Mike
On 19 October 2011 22:35, bharath87 <craze.stuff at gmail.com> wrote:
> Hi Michael,
> Thanks for your reply... consider the situation where there
> are lot of rules each of which might or might not have unique input
> contraints..
>
> for e.g.
>
> rule "Rule1"
>
> when
> Person ( ssn == "input1" )
> then
> .....
>
> end
>
> rule "Rule2"
>
> when
> Person ( ssn == "input2" and citizenship == "inputCountry" )
> then
> .....
> end
>
> In the above scenario the ssn input for Rule1 differs from the ssn input
> for
> Rule2, if i use SSN() facts i will have the rules fire for each ssn facts
> present in the working memory.
>
> what do i do?
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/externalization-of-input-constraints-in-a-rule-tp3435495p3435834.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111020/9d9db9da/attachment.html
More information about the rules-users
mailing list