Title: RE: JESS: Very simple defquery question

JZ,

http://herzberg.ca.sandia.gov/jess/docs/61/language.html#queries

This section of the manual has both a jess and java version of iterating through the query results - scroll down a bit, if necessary, to see the java code.

See also:

http://www.manning.com/friedman-hill


alan

Disclaimer: My company provided me with this broken mailer - my apologies in advance if this is not plain text...


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Jeremic Zoran
Sent: Tuesday, July 20, 2004 8:31 AM
To: [EMAIL PROTECTED]
Subject: JESS: Very simple defquery question


I have batch file as follow:
(deftemplate lesson
(slot ordinalNumber (type INTEGER))
(slot ID (type INTEGER))
(slot difficultyLevel (type INTEGER))
(slot belongs-to-concept (type INTEGER)))

(defquery find-lessons
(declare (variables ?currConc ?diffLevel))
(lesson (difficultyLevel ?p&: (eq ?p ?diffLevel)) ( belongs-to-concept ?s&: (eq ?s ?currConc))))

and I need to run query from Java and read values of lesson's slots for all choosen lessons. I have tried to write something like this:


public void runQueryFindLessons(int currConc, int diffLev) {
try {
ValueVector vv = new ValueVector();
vv.add(new Value(currConc, RU.INTEGER));
vv.add(new Value(diffLev, RU.INTEGER));
Iterator it = engine.runQuery("find-lessons", vv);
System.out.println("Funkcija runQueryFindLessons klase DiscoursePlanner");
try {
   while (it.hasNext()) {
                System.out.println(" in this part I need to read lesson slots");
             }
  }  catch (NoSuchElementException ex) {
     }
       }
catch (JessException je) {
    }
   }

Reply via email to