Inserting two equal objects results in two facts, and each will trigger a matching rule.<br><br>If your class Result contains a proper implementation of equals() and hashCode(), you<br>may use<br>�� KnowledgeBaseConfiguration conf = ....<br>
�� conf.setOption( AssertBehaviorOption.IDENTITY );<br>�� KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( conf );<br>and then inserting another equal object will be ignored by the engine.<br><br>You should not use<br>
� not( exists(...) )<br>not() alone is the negated existence quantifier. Although not wrong,<br>it's generally considered to be inelegant and confusing.<br><br>-W<br><br><div class="gmail_quote">2010/11/8 J-C Walmetz <span dir="ltr"><<a href="mailto:jc7442@yahoo.fr">jc7442@yahoo.fr</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 style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"><div>Hi<span style="font-style: italic;"><br>
<br>I use Drools 5.01<br><br></span>I have the following rules:<br>�<span style="font-style: italic;"><br>rule "Reload test" salience 10000</span><br style="font-style: italic;"><span style="font-style: italic;">��� when</span><br style="font-style: italic;">
<span style="font-style: italic;">��� ��� $result: Result( $resultId:resultId)</span><br style="font-style: italic;"><span style="font-style: italic;">��� ��� not (exists Test(resultId.technicalId==$resultId.technicalId))</span><br style="font-style: italic;">
<span style="font-style: italic;">��� then</span><br style="font-style: italic;"><span style="font-style: italic;">��� ��� Test
test = createTest($resultId);</span><br style="font-style: italic;"><span style="font-style: italic;">���� ��� insert(test);</span><br style="font-style: italic;"><span style="font-style: italic;">end </span><br><br><span style="font-style: italic;">When I� </span>insert two results with the same identifier, rules is applyed 2 times. One for each result. I do not understand why. <br>
<br>Do you have an idea of what's happen and how to guratantee that myl rules will not be applied twice. Here order is not important ...<br><br>Thanks<br><span style="font-style: italic;"></span></div>
</div><br>
</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>