<div dir="ltr"><br> Eric,<br><br> Unfortunately, in his case does not matter if he is using identity or equality behavior, because the problem is in the constraint, that is telling the engine to use equals():<br><br>applicant == $applicant<br>
<br> []s<br> Edson<br><br><br><br><br><br><div class="gmail_quote">2008/8/4 Fenderbosch, Eric <span dir="ltr"><<a href="mailto:Eric.Fenderbosch@fedex.com">Eric.Fenderbosch@fedex.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><font color="#0000ff" size="2" face="Arial"><span>How is your rule base configured, with identity or
equality assert behavior?</span></font></div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font size="2" face="Tahoma"><b>From:</b> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of
</b><a href="mailto:ringsah@comcast.net" target="_blank">ringsah@comcast.net</a><br><b>Sent:</b> Monday, August 04, 2008 9:59
AM<br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] "Not"
Non-Existential Quantifier<br></font><br></div><div><div></div><div class="Wj3C7c">
<div></div>
<div>
<div>Edson,</div>
<div> </div>
<div>I finally succeeded in coming up with a simple test case that shows the
problem. I have attached the necessary files, which include a test case, three
fact objects, and the drl.</div>
<div> </div>
<div>One key to this test are the fact that the Applicant fact object has
an "equals" method that tests for equality of its attributes, rather than
identity. A second key is that the applicant object is updated after
it is inserted.</div>
<div> </div>
<div>It appears that what is happening is that an activation is created for the
rule that uses "not" when the applicant is inserted. Then, when the applicant is
updated, a second activation is created for that rule. It should be cancelling
the previous activation, but doesn't find it because the Applicant instance no
longer "equals" the fact object that caused the activation.</div>
<div> </div>
<div>Thanks!</div>
<div>-Hans</div>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;">--------------
Original message -------------- <br>From: "Edson Tirelli"
<<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>> <br>
<div dir="ltr"><br> Hans, <br><br> Your reasoning is
correct. There should not be 2 instances of ApplicantStatus in the working
memory. <br><br> Can you provide a test case showing the problem?
we have test cases here using "not" and logical assertions, and it works
properly.<br><br> Thanks,<br>
Edson<br><br>
<div class="gmail_quote">2008/7/31 <span dir="ltr"><<a href="mailto:ringsah@comcast.net" target="_blank">ringsah@comcast.net</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div><font size="2">
<p>How is "</p></font><font size="2" face="Courier New">not</font><font size="2">" supposed to work with </font><font size="2" face="Courier New">insertLogical</font><font size="2">? Assume I have two different rules
whose conditions are mutually exclusive, like the following:</font><b><font color="#960000" size="2" face="Courier New">
<p>rule</p></font></b><font size="2" face="Courier New"></font><font color="#008000" size="2" face="Courier New">"</font><font color="#008000" size="2" face="Courier New">Rule One</font><font color="#008000" size="2" face="Courier New">"</font><font size="2" face="Courier New">
<p></p></font><b><font color="#960000" size="2" face="Courier New">when</font></b><font size="2" face="Courier New">
<p></p></font><font size="2" face="Courier New">not
NegativeResult()</font><font size="2" face="Courier New">
<p></p></font><b><font color="#960000" size="2" face="Courier New">then</font></b><font size="2" face="Courier New">
<p></p></font><b><font color="#960000" size="2" face="Courier New">insertLogical</font></b><font size="2" face="Courier New">(</font><font size="2" face="Courier New">new ApplicantStatus("Approved")</font><font size="2" face="Courier New">);</font><b><font color="#960000" size="2" face="Courier New">
<p>end</p></font></b><font size="2" face="Courier New"></font><b><font color="#960000" size="2" face="Courier New">
<p>rule</p></font></b><font size="2" face="Courier New"></font><font color="#008000" size="2" face="Courier New">"</font><font color="#008000" size="2" face="Courier New">Rule Two</font><font color="#008000" size="2" face="Courier New">"</font><font size="2" face="Courier New">
<p></p></font><b><font color="#960000" size="2" face="Courier New">when</font></b><font size="2" face="Courier New">
<p></p></font><font size="2" face="Courier New">NegativeResult()</font><font size="2" face="Courier New">
<p></p></font><b><font color="#960000" size="2" face="Courier New">then</font></b><font size="2" face="Courier New">
<p></p></font><b><font color="#960000" size="2" face="Courier New">insertLogical</font></b><font size="2" face="Courier New">(</font><font size="2" face="Courier New">new ApplicantStatus("Denied")</font><font size="2" face="Courier New">);</font><b><font color="#960000" size="2" face="Courier New">
<p>end</p></font></b><font size="2" face="Courier New"></font><font size="2">
<p>Assume that the above two rules are the only way an </p></font><font size="2" face="Courier New">ApplicantStatus</font><font size="2"> fact can be
inserted into working memory. I would expect, after all rules are run, that
it would be impossible for there to be one </font><font size="2" face="Courier New">ApplicantStatus</font><font size="2"> with </font><font size="2" face="Courier New">"Approved"</font><font size="2"> as its reason, and
another with </font><font size="2" face="Courier New">"Denied"</font><font size="2"> as its reason, in the working memory.
<p>I would expect that, before any </p></font><font size="2" face="Courier New">NegativeResult</font><font size="2"> is inserted, that rule one could
run, and insert an </font><font size="2" face="Courier New">ApplicantStatus</font><font size="2"> fact with an </font><font size="2" face="Courier New">"Approved"</font><font size="2"> reason. Then, after
a </font><font size="2" face="Courier New">NegativeResult</font><font size="2">
is inserted, that rule two could run, and insert an </font><font size="2" face="Courier New">ApplicantStatus</font><font size="2"> fact with a
</font><font size="2" face="Courier New">"Denied"</font><font size="2"> reason.
At this point I would expect that the original </font><font size="2" face="Courier New">ApplicantStatus</font><font size="2"> fact, with an
</font><font size="2" face="Courier New">"Approved"</font><font size="2">
reason, would be retracted, since the conditions under which it was inserted
are no lon! ger true.
<p>This is not what I am observing, however. I am finding </p></font><font size="2" face="Courier New">ApplicantStatus</font><font size="2"> facts with
both reasons in working memory at the end of the rules run. Should "not"
work as I expect with regard to inserting a fact via </font><font size="2" face="Courier New">insertLogical()</font><font size="2">? Or is this a
known limitation, or simply the way it is designed to work?
<p>Thanks,</p>
<p>-Hans</p></font></div></div><br>_______________________________________________<br>rules-users
mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br><br clear="all"><br>-- <br>Edson Tirelli<br>JBoss Drools Core Development<br>JBoss,
a division of Red Hat @ <a href="http://www.jboss.com/" target="_blank">www.jboss.com</a><br></div></blockquote></div></div></div></div>
<br>_______________________________________________<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>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>