[rules-users] Question about insertLogical

Gras, Patrick Patrick.Gras at generali.ch
Thu May 8 08:26:41 EDT 2008


Hello,

I have a question because insertLogical does not behave as I expected.

Here is the example I use; I have a class 'cat' that is dynamic (JavaBean with PropertyChangeSupport ) with only a 'name' attribute.

Then I have following rule:

rule "test"
	when
		$cat:Cat( name == "tom" )
	then 
		$cat.setName("cat");
		insertLogical(new String("test"));
		
end

When I test the rule against a cat named tom, the logical inserted fact is not retracted. (So the fact is inserted because the rule matches, but is not retracted even if the rule is no more matching at the end.)

If I change the order of the RHS, it works fine. The fact is inserted and then retracted.

rule "test"
	when
		$cat:Cat( name == "tom" )
	then 
		insertLogical(new String("test"));
		$cat.setName("cat");
end

Is that the normal behavior ?

-Patrick

Patrick Gras
GENERALI Assurances 
Service Informatique
Avenue Perdtemps 23
1260 Nyon 1
Tél. direct: +41 58 471 05 87
<mailto:patrick.gras at generali.ch>
P Please consider the environment before printing this E-Mail!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080508/d2debc02/attachment.html 


More information about the rules-users mailing list