On 19 July 2011 13:42, Marc Heinz <span dir="ltr">&lt;<a href="mailto:marc.heinz@no-log.org">marc.heinz@no-log.org</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
rule &quot;Single rule check age&quot;<br>
when<br>
        p : Person( age &gt; 18 )<br>
then<br>
        System.out.println(&quot;Single rule fired&quot;);<br>
end<br>
<br>
rule &quot;Rule 1 of n&quot;<br>
    when<br>
        p : Person( name.equals(&quot;Adam&quot;) )<br>
    then<br>
        System.out.println(&quot;Rule 1 of n fired&quot;);<br>
end<br>
<br>
// [...] hundred of others similar rules that will perform a check on the<br>
// name attribute.<br>
=================================<br>
<br>
And with the following java code:<br>
<br>
Person p = new Person();<br>
p.setAge(22);<br>
p.setName(&quot;Adam&quot;);<br>
FactHandle fh = ksession.insert(p);<br>
ksession.fireAllRules();<br>
p.setAge(23);<br>
ksession.update(fh, p);<br>
ksession.fireAllRules();<br>
<br>
This will actually produce the output:<br>
Rule 1 of n fired<br>
Single rule fired<br>
Rule 1 of n fired<br>
Single rule fired<br>
<br>
So, despite I have only updated one attribute of the fact (the age of a<br>
Person), all rules have been fired again, even if they had nothing to do<br>
with the said attribute, which could possibly produce a huge overhead.<br>
<br>
I maybe misunderstood some basic concept here... But is there a way to<br>
prevent that?<br></blockquote><div><br>Reevaluation of all patterns referring to the type of  a fact/object that has been changed is a fundamental principle of production rule systems. <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

For example, I expect a different behavior when using a<br>
PropertyChangeSupport object that would fire events only for specific<br>
fields (but I wasn&#39;t able to test it yet)...<br></blockquote><div><br>Reaction to a property change event is just<br>  wm.update( factHandle, object )<br> <br>-W<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>
Thanks,<br>
<font color="#888888">Marc<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>