On 18/04/2011 17:08, Wolfgang Laun wrote:
This doesn't seem to be quite correct.

    * There's a fact "location" and another one "Location" - are they
      the same?

that misses something, it was just a sample of queries. I had a location query that maps to the Location fact.
            "query location( String thing, String location ) \n" +
" org.drools.integrationtests.BackwardChainingTest.Location( thing : thing, location : location ) \n"+
            "end\n" +

That shouldn't be needed after the changes sotty jsut did to allow positional of Fact patterns too.

    * Query "look" is defined; query "look2" is referenced.

I already updated the blog.

    * How is the fact L/location defined?

There is a single knowlege store, that hasn't changed. it's no different to the way that standard querries work.

Mark
Regards
Wolfgang




On 18 April 2011 16:57, Mark Proctor <mproc...@codehaus.org <mailto:mproc...@codehaus.org>> wrote:

    Here is a more friendly example based around "Adventures in Proglog"'s
    "Nani Search". This is just a sampling of queries and rules, which it
    uses to provide an adventure like game environment. The "?" means to
    pull results, rather than the normal reactive nature of patterns.
    http://www.amzi.com/AdventureInProlog/

    query niceFood( String thing, String location )
        location(thing, location) and
        edible(thing)
    end

    query connect( String x, String y )
        door(x, y;)
        or
        door(y, x;)
    end

    query look(String place, List things, List exits)
        things : List() from accumulate( Location(thing, place;) ,

    collectList( thing ) )
        food : List() from accumulate( ?niceFood(thing, place;) ,
                                                            collectList(
    thing ) )
        exits : List() from accumulate( ?connect(place, exit;) ,
                                                             collectList(
    [place, exit] ) )
    end

    rule reactiveLook when
        Here( place : location)
        ?look2(place, things, exits)
    then       System.out.println( "  You are in the " + place );
        System.out.println( "  You can see " + things );
        System.out.println( "     You can eat" + eat );
        System.out.println( "     You can go to " + exits );
    end

    -----Output----
      You are in the kitchen
         You can see [crackers, broccoli, apple]
         You can eat[crackers, apple]
         You can go to [[kitchen, dining room], [kitchen, cellar]]

    _______________________________________________
    rules-dev mailing list
    rules-dev@lists.jboss.org <mailto:rules-dev@lists.jboss.org>
    https://lists.jboss.org/mailman/listinfo/rules-dev



_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Reply via email to