I have the following rules and facts in Jess:

(defrule ruleone (enter name) => (store first red) (assert (enter place)))
(defrule ruletwo (enter place) => (store first blue) (assert (enter animal)))
(reset)
(assert (enter name))

I have the following code in Java to retrieve the facts red and blue
and print them.

import jess.*;

public class ReteFirst {



      public static String forwardQuestions() throws Exception {

              Rete engine = new Rete();
              engine.executeCommand ("(batch firstrules.clp)");

              //System.out.println ("New Rete is created");
              engine.run();

              Value myValue = engine.fetch("first");

              String s = myValue.stringValue(engine.getGlobalContext());

              return s;
      }



      public static void main(String args[]) throws Exception {

              //ReteFirst a = new ReteFirst();


              System.out.println(ReteFirst.forwardQuestions());




      }
}

When I execute this code I get only the last fact ie blue printed.  I
need both facts printed. Is there a specific function to search the
working memory to test the existence of fact based on the head?

Please help.
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to