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
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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users