"or" causes two rules to be generated internally hence the double activation you report.

i.e. the following are generated internally:-

rule "internal 1"
when
    Person  ( gender == "Female" )
then
    resultIds.add("id_1000")
end

rule "internal 2"
when
    Procedure( needToDone == "ABC" )
then
    resultIds.add("id_1000")
end

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).

(1)

rule "rule"
when
    (
        Person  ( gender == "Female" )
        or
        Procedure( needToDone == "ABC" )
    )
    not ResultId( value == "id_1000" )
then
    insert(new ResultId("id_1000"));
end

(2)
rule "rule"
salience 0
when
    Person  ( gender == "Female" )
    or
    Procedure( needToDone == "ABC" )
then
    insert(new ResultId("id_1000"));
end

rule "remove duplicates"
salience 1000
when
    $orig : ResultId( $v : value)
    $dup : ResultId( this != $orig, value == $v )
then
    remove( $dup )
end
 

On 10 February 2011 23:14, kashif10 <kash452@yahoo.com> wrote:


1) If I have a Rule definition

when
#conditions

 Person( gender  == "Female")
 or
 Procedure( needToDone == "ABC"))


then
resultIds.add("id_1000");


Is it not short circuit If first condiiton matches?
I get twice time "id_1000" in resultIds.



2) How can I chekc the multiple existence
For Example:

How can I chekc that multiple instances of Procddure have alredayDone= "ABC
"

Rule Definition only chekc once:
Procedure (alredayDone == "ABC")








--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Some-Questions-related-to-execution-tp2470079p2470079.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users