[rules-users] Suppressing reciprocal matches

D Brock David_Brock at mentor.com
Fri Nov 6 12:09:49 EST 2009


I have defined the following rule to detect when duplicate objects (in this
example, Widgets) exist.  This always produces two matches, and therefore
two messages.  I understand why this occurs, but I would like for only one
message to be reported.  I cannot retract one of the widgets after a match
b/c all are needed for additional rules matching.  Is the a conventional way
for accomplishing the elimination of the reciprocal match?

rule "Do not allow duplicate widgets"
	when
		$w : Widget( $name : name )
		Widget( this != $w, name == $name )
	then
		System.out.println( "Duplicate widgets found with name =  " + $name );
end
-- 
View this message in context: http://old.nabble.com/Suppressing-reciprocal-matches-tp26230834p26230834.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list