<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    On 23/06/2011 13:20, Wolfgang Laun wrote:
    <blockquote
      cite="mid:BANLkTinX0nfQKTX+7wnuOEn8aNPpAuxg6Q@mail.gmail.com"
      type="cite">Still not resolved...<br>
      <br>
    </blockquote>
    I have added a test for all the possible insertion orders for that
    particular use case and was not able to reproduce a problem:<br>
<a class="moz-txt-link-freetext" href="https://github.com/droolsjbpm/drools/commit/501f2196dcef754eed5a28b066b50665a5bc29a3">https://github.com/droolsjbpm/drools/commit/501f2196dcef754eed5a28b066b50665a5bc29a3</a><br>
    <br>
    MArk<br>
    <blockquote
      cite="mid:BANLkTinX0nfQKTX+7wnuOEn8aNPpAuxg6Q@mail.gmail.com"
      type="cite">On 22 June 2011 21:40, Mark Proctor <span dir="ltr">&lt;<a
          moz-do-not-send="true" 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'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 "Introduction" 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>
          &nbsp; You can see []<br>
          &nbsp; You can eat []<br>
          <br>
          Insert Here after the others, and it works.<br>
          <br>
          -W<br>
          <br>
          &nbsp;import java.util.List<br>
          <br>
          declare Thing<br>
          &nbsp;&nbsp;&nbsp; thing : String @key<br>
          end<br>
          <br>
          declare Edible extends Thing<br>
          end<br>
          <br>
          declare Location extends Thing<br>
          &nbsp;&nbsp;&nbsp; location : String&nbsp; @key<br>
          end<br>
          <br>
          declare Here<br>
          &nbsp;&nbsp;&nbsp; place : String<br>
          end&nbsp;&nbsp;&nbsp; <br>
          <br>
          rule kickOff<br>
          when<br>
          then<br>
          &nbsp;&nbsp;&nbsp; System.out.println( "insert Here" );<br>
          &nbsp;&nbsp;&nbsp; insert( new Here( "table" ) );<br>
          &nbsp;&nbsp;&nbsp; System.out.println( "insert Edible" );<br>
          &nbsp;&nbsp;&nbsp; insert( new Edible( "peach" ) );<br>
          &nbsp;&nbsp;&nbsp; System.out.println( "insert Location" );<br>
          &nbsp;&nbsp;&nbsp; insert( new Location( "peach", "table" ) );<br>
          end<br>
          <br>
          # 2011-06-22<br>
          query isContainedIn( String x, String y ) <br>
          &nbsp;&nbsp;&nbsp; Location(x, y;)<br>
          &nbsp;&nbsp;&nbsp; or <br>
          &nbsp;&nbsp;&nbsp; ( Location(z, y;) and /*?*/isContainedIn(x, z;) )<br>
          end<br>
          <br>
          query whereFood( String x, String y )<br>
          &nbsp;&nbsp;&nbsp; ( Location(x, y;) and<br>
          &nbsp;&nbsp;&nbsp; Edible(x;) ) <br>
          &nbsp;&nbsp;&nbsp; or <br>
          &nbsp;&nbsp;&nbsp; ( Location(z, y;) and /*?*/whereFood(x, z;) )<br>
          end<br>
          <br>
          query look(String place, List things, List food) <br>
          &nbsp;&nbsp;&nbsp; Here(place;)<br>
          &nbsp;&nbsp;&nbsp; things := List() from accumulate( Location(thing, place;),<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; collectList( thing ) )<br>
          &nbsp;&nbsp;&nbsp; food := List() from accumulate( /*?*/whereFood(thing,
          place;),<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; collectList( thing ) )<br>
          end<br>
          <br>
          rule reactiveLook<br>
          when<br>
          &nbsp;&nbsp;&nbsp; Here( $place : place) <br>
          &nbsp;&nbsp;&nbsp; /*?*/look($place, $things; $food := food)<br>
          then<br>
          &nbsp;&nbsp;&nbsp; System.out.println( "You are in the " + $place);<br>
          &nbsp;&nbsp;&nbsp; System.out.println( "&nbsp; You can see " + $things );<br>
          &nbsp;&nbsp;&nbsp; System.out.println( "&nbsp; You can eat " + $food );<br>
          end<br>
          <br>
        </div>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>