org.openrdf.result
Interface Result<T>

All Superinterfaces:
CloseableIteration<T,QueryEvaluationException>, Iteration<T,QueryEvaluationException>
All Known Implementing Classes:
ResultImpl

public interface Result<T>
extends CloseableIteration<T,QueryEvaluationException>

Super type of all query result types (TupleQueryResult, GraphQueryResult, etc.).

Author:
Arjohn Kampman, James Leigh

Method Summary
<C extends Collection<? super T>>
C
addTo(C collection)
           
 List<T> asList()
           
 Set<T> asSet()
           
 void close()
          Closes this cursor, freeing any resources that it is holding.
 boolean hasNext()
           
 T next()
          Returns the next element from this cursor.
 T singleResult()
           
 String toString()
          Describes this cursor (recursively for any wrapped cursors).
 
Methods inherited from interface info.aduna.iteration.Iteration
remove
 

Method Detail

next

T next()
       throws QueryEvaluationException
Returns the next element from this cursor.

Specified by:
next in interface Iteration<T,QueryEvaluationException>
Returns:
the next element from this cursor, or null if the cursor has no more elements.
Throws:
QueryEvaluationException

close

void close()
           throws QueryEvaluationException
Closes this cursor, freeing any resources that it is holding. If the cursor has already been closed then invoking this method has no effect. After closing a cursor, any subsequent calls to next() will return null.

Note to implementors: this method is also used to abort long running evaluations. It should be implemented in such a way that it can be called concurrently with next() and that it stops evaluation as soon as possible. Calls to next() that are already in progress are allowed to still return results, but after returning from close() , the cursor must not produce any more results.

Specified by:
close in interface CloseableIteration<T,QueryEvaluationException>
Throws:
QueryEvaluationException

toString

String toString()
Describes this cursor (recursively for any wrapped cursors).

Overrides:
toString in class Object

hasNext

boolean hasNext()
                throws QueryEvaluationException
Specified by:
hasNext in interface Iteration<T,QueryEvaluationException>
Throws:
QueryEvaluationException

singleResult

T singleResult()
               throws QueryEvaluationException,
                      NoResultException,
                      MultipleResultException
Throws:
QueryEvaluationException
NoResultException
MultipleResultException

asList

List<T> asList()
               throws QueryEvaluationException
Throws:
QueryEvaluationException

asSet

Set<T> asSet()
             throws QueryEvaluationException
Throws:
QueryEvaluationException

addTo

<C extends Collection<? super T>> C addTo(C collection)
                                      throws QueryEvaluationException
Throws:
QueryEvaluationException


Copyright © 2004-2011 James Leigh Services Inc.. All Rights Reserved.