"or" causes two rules to be generated internally hence the double activation you report.<br><br>i.e. the following are generated internally:-<br><br>rule "internal 1"<br>when<br> Person ( gender == "Female" )<br>
then<br> resultIds.add("id_1000")<br>end<br><br>rule "internal 2"<br>
when<br>
Procedure( needToDone == "ABC" )<br>
then<br>
resultIds.add("id_1000")<br>
end<br>
<br>There are different ways to tackle the duplicate; (1) prevent it from occurring in the first instance, (2) remove duplicates afterwards, both of which are simplified if "resultIds" becomes a Fact rather than presumably a global (although still possible).<br>
<br>(1)<br><br>rule "rule"<br>when<br> (<br> Person ( gender == "Female" )<br> or<br> Procedure( needToDone == "ABC" )<br> )<br>
not ResultId( value == "id_1000" )<br>
then<br>
insert(new ResultId("id_1000"));<br>
end<br>
<br>(2) <br>rule "rule"<br>salience 0<br>
when<br>
Person ( gender == "Female" )<br>
or<br>
Procedure( needToDone == "ABC" )<br>then<br>
insert(new ResultId("id_1000"));<br>
end<br><br>rule "remove duplicates"<br>salience 1000<br>when<br> $orig : ResultId( $v : value)<br> $dup : ResultId( this != $orig, value == $v )<br>then<br> remove( $dup )<br>end<br> <br>
<br><div class="gmail_quote">On 10 February 2011 23:14, kashif10 <span dir="ltr"><<a href="mailto:kash452@yahoo.com">kash452@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
<br>
1) If I have a Rule definition<br>
<br>
when<br>
#conditions<br>
<br>
Person( gender == "Female")<br>
or<br>
Procedure( needToDone == "ABC"))<br>
<br>
<br>
then<br>
resultIds.add("id_1000");<br>
<br>
<br>
Is it not short circuit If first condiiton matches?<br>
I get twice time "id_1000" in resultIds.<br>
<br>
<br>
<br>
2) How can I chekc the multiple existence<br>
For Example:<br>
<br>
How can I chekc that multiple instances of Procddure have alredayDone= "ABC<br>
"<br>
<br>
Rule Definition only chekc once:<br>
Procedure (alredayDone == "ABC")<br>
<font color="#888888"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Some-Questions-related-to-execution-tp2470079p2470079.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Some-Questions-related-to-execution-tp2470079p2470079.html</a><br>
Sent from the Drools - User 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>
</font></blockquote></div><br>