Still not resolved...<br><br>On 22 June 2011 21:40, Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</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;">
heh, I made a mistake with the rule<br>
<div class="im">( Location(z, y;) and ?hasFood(x, z;) )<br>
</div>should be<br>
<div class="im">( Location(z, y;) and hasFood(x, z;) )<br>
<br>
</div>Otherwise it&#39;s not reactive, and then ordering matters.<br>
<br>
With that change I can do the insertions in any order and all is fine.<br>
<br></blockquote><div><br>This works for the example you gave. But the one taken from the &quot;Introduction&quot; still depends on the order the facts are inserted. Below is the .drl, which does not need any pojos. Rule  kickOff contains the order that produces nothing to see and eat:<br>
You are in the table<br>  You can see []<br>  You can eat []<br><br>Insert Here after the others, and it works.<br><br>-W<br><br> import java.util.List<br><br>declare Thing<br>    thing : String @key<br>end<br><br>declare Edible extends Thing<br>
end<br><br>declare Location extends Thing<br>    location : String  @key<br>end<br><br>declare Here<br>    place : String<br>end    <br><br>rule kickOff<br>when<br>then<br>    System.out.println( &quot;insert Here&quot; );<br>
    insert( new Here( &quot;table&quot; ) );<br>    System.out.println( &quot;insert Edible&quot; );<br>    insert( new Edible( &quot;peach&quot; ) );<br>    System.out.println( &quot;insert Location&quot; );<br>    insert( new Location( &quot;peach&quot;, &quot;table&quot; ) );<br>
end<br><br># 2011-06-22<br>query isContainedIn( String x, String y ) <br>    Location(x, y;)<br>    or <br>    ( Location(z, y;) and /*?*/isContainedIn(x, z;) )<br>end<br><br>query whereFood( String x, String y )<br>    ( Location(x, y;) and<br>
    Edible(x;) ) <br>    or <br>    ( Location(z, y;) and /*?*/whereFood(x, z;) )<br>end<br><br>query look(String place, List things, List food) <br>    Here(place;)<br>    things := List() from accumulate( Location(thing, place;),<br>
                                      collectList( thing ) )<br>    food := List() from accumulate( /*?*/whereFood(thing, place;),<br>                                    collectList( thing ) )<br>end<br><br>rule reactiveLook<br>
when<br>    Here( $place : place) <br>    /*?*/look($place, $things; $food := food)<br>then<br>    System.out.println( &quot;You are in the &quot; + $place);<br>    System.out.println( &quot;  You can see &quot; + $things );<br>
    System.out.println( &quot;  You can eat &quot; + $food );<br>end<br><br></div></div>