[rules-users] Cause(LHS) of rule an query brings different results.

Tomasz Krzywicki tkrzywicki at gmail.com
Mon Aug 18 11:15:10 EDT 2008


I have query and rule which have identical LHS or "cause"
for some unknown for me reason my query returns only one Item
while rule is fired multiple times showing multiple occurences of my
desired facts.

query "my query"	
    i:  Item( x == "A", q > 0 ) or
        Item( x == "B", q > 1 ) or
	
   	 $x: Ref( name=="Exp" ) and
         Item( x == "A", quantity > 0 ) from $x.items
end


rule "my query test"
  when	
    i:  Item( x == "A", q > 0 ) or
        Item( x == "B", q > 1 ) or
   		
   	 $x: Ref( name=="Exp" ) and
        Item( x == "A", quantity > 0 ) from $x.items
  then
        System.out.println ("FOUND: "+i);
end

There must be something fundamentally wrong in the approach I am
taking ;)

I am using drools 4.0.7

Thanks in advance

tk



More information about the rules-users mailing list