well, with nulls, it only makes sense if you have knowledge that a given field is NOT a primitive, which is clearly something that only the developer would know.<br><br>So basically, from what I am hearing, because we transparently allow primitives, null should not be treated specially, other then for equality. Dealing with specific inequality for example:
<br><br>Foo(field != 3) could be true if field is null. However, Foo(field <, contains, > etcc....) will ALWAYS be false if field is null. The only thing that could be true when a field is null is equality, or not equals.
<br>I will add some more tests for this.<br><br><div><span class="gmail_quote">On 3/17/07, <b class="gmail_sendername">Felipe Piccolini</b> <<a href="mailto:felipe.piccolini@bluesoft.cl">felipe.piccolini@bluesoft.cl</a>
> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="">As I see it, this is not like SQL, because Tom said "<span>
<font color="#0000ff" face="Arial" size="2"><span style="font-size: 10px;">null is returned when an access fails or some error occurs"<font color="#000000" face="Helvetica" size="3"><span style="font-size: 12px;">, but then the guy
</span></font></span></font></span><div>who prepare the SQL statements has to be acknowloedge of the meaning of a null return, so he writes the querys in a</div><div>correct way to the application. Here thats not the case, the guy who writes the rules doesn't need to know why that
</div><div>field is null, or 0 or blank, he ask for a statement of truth (field != 3), he spect not reason why that field is not 3, maybe </div><div>the value of the field is 0,1,2,4,5... null, " ", or whatever another value possible, he is just asking to not be specific one.
</div><div>If someone need to manage the null value in a diferent way, then he must prepare the Fact Objects, Value Objects, Pojos,</div><div>Wrappers in a diferent way, design to do what he wants to be done with null values but not at the rules language level.
</div><div><br></div><div>If I wanna ask for null value in a field to check for errors for example, I should ask for that " Fact( field == null )".</div><div><br></div><div>Maybe it could be a parametric flag somewhere telling the engine how to manage nulls, and set a default...
</div><div><br></div><div>Another question: How the engine manage to return to Fact( field == null) when field is a primitive?, it makes autoboxing?,</div><div>comaparing Integer (for int) to null or something like that?, if the Engine do so, why?, maybe the rule's writer was wrong when
</div><div>he wrote that, or maybe he just wanted to check if the field is blank/zero/not setter/etc... </div><div><span class="e" id="q_1115b5c34d14575b_1"><div><br></div><div><br></div><div><div><div>On 15-03-2007, at 20:23, Michael Neale wrote:
</div><br><blockquote type="cite">Felipe - yes that is consistent.<br><br>But what about:<br><br>Fact( field != 3 )<br>now if field is null, its certainly not equal to 3, but should this be true? or because of null, it is always false?
<br><br>In SQL, it would always be false. <br><br><div><span class="gmail_quote">On 3/16/07, <b class="gmail_sendername">Felipe Piccolini</b> <<a href="mailto:felipe.piccolini@bluesoft.cl" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
felipe.piccolini@bluesoft.cl</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div>I think Im not agree with that... the question here is about how the Rule languaje will treat an expresion
<div>made by a businness agent to the rules... so when a rule has a condition writen like this:</div> <div> Fact( field > 3)</div><div> this is asking : Is there a fact of type Fact which has a field and the value of that value is greater that 3..
</div><div><br></div><div>So, if the Fact actually exists and for 'some reason' its field "field" has a value which is not greater than 3 </div><div>(the rule doesn't need to know why the value is not 3, or is 0, or null or whatever) then the condition must
</div><div>return (or been evaluated as) false. Its responsability for the DAO or fill implementation of the fact to put the </div><div>right value on its fields, the values that MEAN something. If its null it is possible that the value was never
</div><div>setted or initialized, or maybe it means something else. If a bussiness guy wants to ask for been null </div><div> Fact( field == null) </div><div>then that question is a meaningfull one, dont let programmers decide what it means. If I wanna to ask for
</div><div>being greater that 3, and it has no value, then the answer is NO, "it is NO greather than 3". </div><div><br></div><div>well... this is just my humile opinion btw....</div><div><br></div><div><br></div>
<div><div><span><br><div><div>On 15-03-2007, at 13:03, Tom Gonzalez wrote:</div> <br><blockquote type="cite"> <div><font color="#0000ff" face="Arial" size="2"><span>We handle it as it can't be anything else but null cause null is returned when an access fails or some error occurs. This keeps it from falling into a valid evaluation and possibly a subtle bug going uncaught.
</span></font></div> <div><font color="#0000ff" face="Arial" size="2"><span></span></font> </div> <div><font color="#0000ff" face="Arial" size="2"><span>Tom G</span></font></div><br> <div dir="ltr" align="left" lang="en-us">
<hr> <font face="Tahoma" size="2"><b>From:</b> <a href="mailto:rules-dev-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-dev-bounces@lists.jboss.org</a> [<a href="mailto:rules-dev-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
mailto:rules-dev-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Mark Proctor<br><b>Sent:</b> Thursday, March 15, 2007 12:42 PM<br><b>To:</b> Rules Dev List<br><b>Subject:</b> Re: [rules-dev] need advice re null handling
<br></font><br></div> <div></div>Its not about giving it up, its how we handle when those fields are null, do we treat it like a primitive and assume its 0, or do we say it can't be equal to anything else but null.<br>
<br>In the following example neither y or z is defined, thus y is null and z is 0;<br><br>int x = 0;<br>Integer y;<br>in z;<br>x == y // is false;<br>x == z // is true<br>y == null // is true<br><br>Mark<br><br>Tom Gonzalez wrote:
<blockquote type="cite"> <div><span><font color="#0000ff" face="Arial" size="2">The flexibility provided by an Object is very valuable. We use Integer and String objects all over the place today in our facts with drools. I would hate to give it up.
</font></span></div> <div><span></span> </div> <div><span><font color="#0000ff" face="Arial" size="2">Tom G</font></span></div><br> <div dir="ltr" align="left" lang="en-us"> <hr> <font face="Tahoma" size="2"><b>From:
</b> <a href="mailto:rules-dev-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-dev-bounces@lists.jboss.org</a> [<a href="mailto:rules-dev-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
mailto:rules-dev-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Mark Proctor<br><b>Sent:</b> Thursday, March 15, 2007 6:29 AM<br><b>To:</b> Rules Dev List<br><b>Subject:</b> Re: [rules-dev] need advice re null handling
<br></font><br></div>if bar is an integer it will be 0, if its an Integer it will be null. The Q is do we make Integer work like the primitive, or do we make it work like an Object.<br><br>Mark<br>Michael Neale wrote:
<blockquote type="cite"><a href="http://jira.jboss.com/jira/browse/JBRULES-627" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://jira.jboss.com/jira/browse/JBRULES-627</a><br><br>OK, this much is clear:
<br><br>Foo(field == null) can be true if field is null.<br><br>but, what about Foo(field > 3), and field is null? should that be false? what about Foo(field != 3) - should that be true? <br><br>in SQL, null will always result in a false condition, unless you explicitly use null.
<br><br>Thoughts? <br><br>Michael.<br><pre><hr size="4" width="90%">_______________________________________________<br>rules-dev mailing list<br><a href="mailto:rules-dev@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre></blockquote><br><pre><hr size="4" width="90%">_______________________________________________<br>rules-dev mailing list<br><a href="mailto:rules-dev@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre></blockquote><br><div style="margin: 0px;">_______________________________________________</div><div style="margin: 0px;">rules-dev mailing list</div><div style="margin: 0px;"><a href="mailto:rules-dev@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-dev@lists.jboss.org</a></div><div style="margin: 0px;"><a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-dev
</a></div> </blockquote></div><br></span></div><div> <span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<div><span style="text-decoration: underline;"><span> </span></span><div><font size="3"><span style="font-size: 13px;"><b style="font-size: 13px; font-weight: bold;">
<span style="font-size: 13px; font-weight: bold;">Felipe Piccolini M.</span></b></span></font></div><div><a href="mailto:felipe.piccolini@bluesoft.cl" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
<span style="color: rgb(0, 0, 238);">felipe.piccolini@bluesoft.cl</span></a></div><br></div><div><br></div><br></span> </div><br></div></div><br>_______________________________________________<br>rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-dev</a><br><br></blockquote></div><br><div style="margin: 0px;">_______________________________________________</div><div style="margin: 0px;">rules-dev mailing list</div><div style="margin: 0px;">
<a href="mailto:rules-dev@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-dev@lists.jboss.org</a></div><div style="margin: 0px;"><a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-dev</a></div> </blockquote></div><br><div> <span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<div><span style="text-decoration: underline;"><span> </span></span><div><font size="3"><span style="font-size: 13px;"><b style="font-size: 13px; font-weight: bold;">
<span style="font-size: 13px; font-weight: bold;">Felipe Piccolini M.</span></b></span></font></div><div><a href="mailto:felipe.piccolini@bluesoft.cl" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
<span style="color: rgb(0, 0, 238);">felipe.piccolini@bluesoft.cl</span></a></div><br></div><div><br></div><br></span> </div><br></div></span></div></div><br>_______________________________________________<br>rules-dev mailing list
<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">
https://lists.jboss.org/mailman/listinfo/rules-dev</a><br><br></blockquote></div><br>