Hello group,

Assuming I have the rule:

rule "try not to loop"
    when
        $a : A($code : code)
        $b : B(parentCode == $code)
    then
        addResult($a, $b);
end


and the classes:

public class A {
int code;
}

public class B {
int parentCode;
}



I insert into the WM 4 objects :
A(code = 1), A(code = 2);
B(parentCode=1), B(parentCode = 2);

I would like that after calling fireAllRules() only 1 match will be returned. I have no preference regarding which one, in the current situation 2 matches are returned.

Anyone could suggest a method to enforce this ?


Thank you,
Maxim.