I think Prasath Balakrishnan wrote:

> 
> Can somebody guide me to extract the iterator results of this code
> from Jess values to Java values??

First, a word of advice: if you have one short Jess statement to
execute from Jess code, by all means use executeCommand(). But if you
have a great deal of code, it's a terrible mess to read, write and
maintain this way -- it makes much more sense to use a batch
file. 

On the other hand, there are alternatives to executeCommand() in
Jess's Java API, and again, using the alternatives will generally lead
to cleaner code; in particular, the query-processing loop above, which
just deals with an Iterator and some Java objects, would be much
easier to write natively in Java -- and then the problem of extracting
results goes away, as the results are already in Java! So, for
example,

  Iterator it = (Iterator)
    jess.executeCommand("(run-query q_problemtypefinal  ?w ?y ?z)").
          externalAddressValue(null);
  while (it.hasNext()) {
    Token t = (Token) it.next();
    Fact f = t.fact(1);
    int prod_ident = f.getSlotValue("prod-ident").intValue(null);
    System.out.println("prod-ident: " + prod_ident);
    ...
  }

---------------------------------------------------------
Ernest Friedman-Hill  
Science and Engineering PSEs        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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