On Mar 26, 2007, at 5:41 AM, ricktee wrote:
Is there a equivalent of the bolded QueryResult result in Jess 6.1?
Well, no. runQueryStar() and QueryResult are the Jess 7 replacement
for the old, ugly query mechanism in Jess 6 and earlier.
searching the book and docs, I could not find a exact example. I keep
getting a null vaule
Iterator result = r.runQuery ("search-by-
name", new
ValueVector().add(Smith));
Value firstname = r.fetch("fn");
System.out.println("\n what is first name " +
fn);
I don't know why you think fetch("fn") should return anything here.
The Iterator iterates over the set of jess.Token objects that match
the query. Each Token contains one or more jess.Fact objects. Each
Fact contains slots. That's all you get with Jess 6 queries.
Iterator result = r.runQuery(...);
while (result.hasNext()) {
Token t = (Token) result.next();
Fact f = (Fact) t.fact(1);
Value v = f.getSlotValue("fn");
System.out.println("First name is " + v.stringValue
(r.getGlobalContext()));
}
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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]
--------------------------------------------------------------------