Hello!

You can define query:

(defquery printStudents
        (Student (name ?x) (age ?y)))
To define it from Java you need to execute the following code:

rete.eval("(defquery printStudents (Student (name ?x) (age ?y)))"));

Now you have to execute the query:

QueryResult qs = rete.runQueryStar("printStudents", new ValueVector());

and then you can print the result in Java console:

System.out.println("The students are:   name    age");
while(result.next())
{
        try 
        {
                System.out.println("\t\t" + result.getString("x") + "\t" + 
result.getString("y"));
        } catch (JessException e) 
        {
                        e.printStackTrace();
        }
}

That's all. It should works.

-- 
Best regards,
 Jaroslaw Bak, http://www.put.poznan.pl

Reply via email to