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