The same principle applies, but instead of inserting a single SSN container, you insert a generic "parameters" container:-<br><br>rule "rule 1"<br>when<br> Parameters( rule == "rule 1", $ssn : ssn, $citizenship : citizenship )<br>
Person( ssn = $ssn, citizenship == $citizenship )<br>then<br> ....<br><br>If your parameters are more generic Parameters could contain a Map instead of explicit parameters and change the Person pattern accordingly.<br>
<br>It'd be good to be able to extract the rule name in the LHS, but I don't think this is possible (anybody?)<br><br>Cheers,<br><br>Mike<br><br><div class="gmail_quote">On 19 October 2011 22:35, bharath87 <span dir="ltr"><<a href="mailto:craze.stuff@gmail.com">craze.stuff@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Michael,<br>
Thanks for your reply... consider the situation where there<br>
are lot of rules each of which might or might not have unique input<br>
contraints..<br>
<br>
for e.g.<br>
<br>
rule "Rule1"<br>
<br>
when<br>
Person ( ssn == "input1" )<br>
then<br>
.....<br>
<br>
end<br>
<br>
rule "Rule2"<br>
<br>
when<br>
Person ( ssn == "input2" and citizenship == "inputCountry" )<br>
then<br>
.....<br>
end<br>
<br>
In the above scenario the ssn input for Rule1 differs from the ssn input for<br>
Rule2, if i use SSN() facts i will have the rules fire for each ssn facts<br>
present in the working memory.<br>
<br>
what do i do?<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/externalization-of-input-constraints-in-a-rule-tp3435495p3435834.html" target="_blank">http://drools.46999.n3.nabble.com/externalization-of-input-constraints-in-a-rule-tp3435495p3435834.html</a><br>
</font><div><div></div><div class="h5">Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>