Hi,

I'm having a few problems with getting results from a query that I have
defined:

session.executeCommand("(defquery all-triples " +
"(declare (variables ?sub))" +
"(triple (predicate ?pred)" +
"(subject ?sub)" +
"(object   ?obj)))");

I want to get all the predicates and objects for one particular subject:

Iterator res = session.runQuery("all-triples", 
new ValueVector().add(new Value("http://grid.cx/provenance/thesis#doc";, 
RU.STRING)));

This particular subject has 13 triples (orginally RDF) associated with
it, however, Jess prints the first 6 triples, then raises a
NoSuchElementException. I loop through the result like this:


try {
  while (res.hasNext())
{
Token token = (Token) res.next();
System.out.println(res.next());
} 
} catch (NoSuchElementException ex) {
System.out.println("No such element!");
}

I can successfully retrieve all the triples in working memory using:
(defquery all-triples (triple))

then running:
Iterator res = session.runQuery("all-triples", new ValueVector());

which doesn't throw any exception.

Is it possible that my defquery is wrong? I originally wanted to use two
variables to search for the subject using the predicate and object. I
have not successfully done this yet, because I am uncertain how to add
additional variables to the defquery.

Regards,

Rowland Watkins
Declarative Systems & Software Engineering Group,
University of Southampton,
Southampton,
SO17 1BJ

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