On 19 August 2011 15:17, Chris Richmond <span dir="ltr">&lt;<a href="mailto:crichmond@referentia.com">crichmond@referentia.com</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;">
How do I fire a rule if an object with certain characterstics does not<br>
exists.<br>
<br>
For example my class Foo, if I have a rule:<br>
<br>
rule &quot;Identify Foos with values&quot;<br>
<br>
when<br>
         Foo(stringProp==&quot;blah&quot;, intProp==5)<br>
then<br>
         System.err.println(&quot;A Foo was found!&quot;);<br>
end<br>
<br>
<br>
So how do I check for lack of existence of an object with certain<br>
characteristics<br>
<br>
I tried:<br>
rule &quot;Flag missing Foos with values&quot;<br>
<br>
when<br>
         not(Foo(stringProp==&quot;blah&quot;, intProp==5))<br>
then<br>
         System.err.println(&quot;A proper foo does not exist&quot;);<br>
end<br></blockquote><div><br>That&#39;s the way to do it.<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>
I also tried:<br>
rule &quot;Flag missing Foos with values&quot;<br>
<br>
when<br>
         not(exists(Foo(stringProp==&quot;blah&quot;, intProp==5)))<br>
then<br>
         System.err.println(&quot;A proper foo does not exist&quot;);<br>
end<br></blockquote><div><br>Since not( Foo(...)) means &quot;if no Foo(...) exists&quot;, the addition of &quot;exists&quot; is superfluous and generally considered bad style (even though some systems accept it to mean just &quot;not&quot;.<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>
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>
</blockquote></div><br>