Added  BackwardChainingTest.testInsertionOrderTwo  which will <b>fail</b>, so don&#39;t be shocked if Hudson turns purple.<br><br>-W<br><br><br>On 24 June 2011 22:35, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt; wrote:<br>
&gt; On 24/06/2011 21:22, Michael Anstis wrote:<br>&gt;<br>&gt; Your test, Mark, is not the same example to which Wolfgang refers.<br>&gt;<br>&gt; You&#39;ll need to re-test with the DRL at the end of Wolfgang&#39;s email (which is<br>
&gt; what we&#39;ve included in N&amp;N for 5.2).<br>&gt;<br>&gt; It&#39;s quite possible one of the ?&#39;s is simply wrong... but I don&#39;t understand<br>&gt; the subtleties of BC syntax yet.<br>&gt;<br>&gt; If the query has &quot;?&quot; in it, then it&#39;s pull only. In which case the insertion<br>
&gt; order matters, as the query is triggered when Here or in below Person is<br>&gt; triggered. Inserting the Location objects after the query is triggered will<br>&gt; not return a result, unless you use leave off the &quot;?&quot; for a reactive &quot;open<br>
&gt; query&quot;<br>&gt;<br>&gt; Mark<br>&gt;<br>&gt; With kind regards,<br>&gt;<br>&gt; Mike<br>&gt;<br>&gt; On 24 June 2011 21:14, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt; wrote:<br>
&gt;&gt;<br>&gt;&gt; On 23/06/2011 13:20, Wolfgang Laun wrote:<br>&gt;&gt;<br>&gt;&gt; Still not resolved...<br>&gt;&gt;<br>&gt;&gt; I have added a test for all the possible insertion orders for that<br>&gt;&gt; particular use case and was not able to reproduce a problem:<br>
&gt;&gt;<br>&gt;&gt; <a href="https://github.com/droolsjbpm/drools/commit/501f2196dcef754eed5a28b066b50665a5bc29a3">https://github.com/droolsjbpm/drools/commit/501f2196dcef754eed5a28b066b50665a5bc29a3</a><br>&gt;&gt;<br>&gt;&gt; MArk<br>
&gt;&gt;<br>&gt;&gt; On 22 June 2011 21:40, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt; wrote:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; heh, I made a mistake with the rule<br>&gt;&gt;&gt; ( Location(z, y;) and ?hasFood(x, z;) )<br>
&gt;&gt;&gt; should be<br>&gt;&gt;&gt; ( Location(z, y;) and hasFood(x, z;) )<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Otherwise it&#39;s not reactive, and then ordering matters.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; With that change I can do the insertions in any order and all is fine.<br>
&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; This works for the example you gave. But the one taken from the<br>&gt;&gt; &quot;Introduction&quot; still depends on the order the facts are inserted. Below is<br>&gt;&gt; the .drl, which does not need any pojos. Rule kickOff contains the order<br>
&gt;&gt; that produces nothing to see and eat:<br>&gt;&gt; You are in the table<br>&gt;&gt;   You can see []<br>&gt;&gt;   You can eat []<br>&gt;&gt;<br>&gt;&gt; Insert Here after the others, and it works.<br>&gt;&gt;<br>
&gt;&gt; -W<br>&gt;&gt;<br>&gt;&gt;  import java.util.List<br>&gt;&gt;<br>&gt;&gt; declare Thing<br>&gt;&gt;     thing : String @key<br>&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt; declare Edible extends Thing<br>&gt;&gt; end<br>
&gt;&gt;<br>&gt;&gt; declare Location extends Thing<br>&gt;&gt;     location : String  @key<br>&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt; declare Here<br>&gt;&gt;     place : String<br>&gt;&gt; end   <br>&gt;&gt;<br>&gt;&gt; rule kickOff<br>
&gt;&gt; when<br>&gt;&gt; then<br>&gt;&gt;     System.out.println( &quot;insert Here&quot; );<br>&gt;&gt;     insert( new Here( &quot;table&quot; ) );<br>&gt;&gt;     System.out.println( &quot;insert Edible&quot; );<br>&gt;&gt;     insert( new Edible( &quot;peach&quot; ) );<br>
&gt;&gt;     System.out.println( &quot;insert Location&quot; );<br>&gt;&gt;     insert( new Location( &quot;peach&quot;, &quot;table&quot; ) );<br>&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt; # 2011-06-22<br>&gt;&gt; query isContainedIn( String x, String y )<br>
&gt;&gt;     Location(x, y;)<br>&gt;&gt;     or<br>&gt;&gt;     ( Location(z, y;) and /*?*/isContainedIn(x, z;) )<br>&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt; query whereFood( String x, String y )<br>&gt;&gt;     ( Location(x, y;) and<br>
&gt;&gt;     Edible(x;) )<br>&gt;&gt;     or<br>&gt;&gt;     ( Location(z, y;) and /*?*/whereFood(x, z;) )<br>&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt; query look(String place, List things, List food)<br>&gt;&gt;     Here(place;)<br>
&gt;&gt;     things := List() from accumulate( Location(thing, place;),<br>&gt;&gt;                                       collectList( thing ) )<br>&gt;&gt;     food := List() from accumulate( /*?*/whereFood(thing, place;),<br>
&gt;&gt;                                     collectList( thing ) )<br>&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt; rule reactiveLook<br>&gt;&gt; when<br>&gt;&gt;     Here( $place : place)<br>&gt;&gt;     /*?*/look($place, $things; $food := food)<br>
&gt;&gt; then<br>&gt;&gt;     System.out.println( &quot;You are in the &quot; + $place);<br>&gt;&gt;     System.out.println( &quot;  You can see &quot; + $things );<br>&gt;&gt;     System.out.println( &quot;  You can eat &quot; + $food );<br>
&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; rules-dev mailing list<br>&gt;&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; rules-dev mailing list<br>&gt;&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;&gt;<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; rules-dev mailing list<br>&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; rules-dev mailing list<br>&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
&gt;<br>&gt;<br><br>