org.openrdf.query.impl
Class MutableTupleQueryResult

java.lang.Object
  extended by org.openrdf.query.impl.MutableTupleQueryResult
All Implemented Interfaces:
CloseableIteration<BindingSet,QueryEvaluationException>, Iteration<BindingSet,QueryEvaluationException>, Cloneable, QueryResult<BindingSet>, TupleQueryResult

public class MutableTupleQueryResult
extends Object
implements TupleQueryResult, Cloneable

An implementation of the TupleQueryResult interface that stores the complete query result in memory. The query results in a MutableTupleQueryResult can be iterated over multiple times and can also be iterated over in reverse order.

Author:
Arjohn Kampman

Constructor Summary
MutableTupleQueryResult(Collection<String> bindingNames, BindingSet... bindingSets)
           
MutableTupleQueryResult(Collection<String> bindingNames, Collection<? extends BindingSet> bindingSets)
          Creates a query result table with the supplied binding names.
MutableTupleQueryResult(Collection<String> bindingNames, Iteration<? extends BindingSet,E> bindingSetIter)
           
MutableTupleQueryResult(TupleQueryResult tqr)
           
 
Method Summary
 void afterLast()
          Moves the cursor to the end of the query result, just after the last binding set.
 void append(BindingSet bindingSet)
           
 void beforeFirst()
          Moves the cursor to the start of the query result, just before the first binding set.
 void clear()
           
 MutableTupleQueryResult clone()
           
 void close()
           
 BindingSet get(int index)
           
 List<String> getBindingNames()
          Gets the names of the bindings, in order of projection.
 int getIndex()
           
 boolean hasNext()
           
 boolean hasPrevious()
           
 void insert(BindingSet bindingSet)
          Inserts the specified binding set into the list.
 void insert(int index, BindingSet bindingSet)
           
 BindingSet next()
           
 BindingSet previous()
           
 void remove()
           
 BindingSet remove(int index)
           
 void set(BindingSet bindingSet)
           
 BindingSet set(int index, BindingSet bindingSet)
           
 void setIndex(int index)
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutableTupleQueryResult

public MutableTupleQueryResult(Collection<String> bindingNames,
                               BindingSet... bindingSets)
                        throws E extends Exception
Throws:
E extends Exception

MutableTupleQueryResult

public MutableTupleQueryResult(Collection<String> bindingNames,
                               Collection<? extends BindingSet> bindingSets)
Creates a query result table with the supplied binding names. The supplied list of binding names is assumed to be constant; care should be taken that the contents of this list doesn't change after supplying it to this solution.

Parameters:
bindingNames - The binding names, in order of projection.

MutableTupleQueryResult

public MutableTupleQueryResult(Collection<String> bindingNames,
                               Iteration<? extends BindingSet,E> bindingSetIter)
                        throws E extends Exception
Throws:
E extends Exception

MutableTupleQueryResult

public MutableTupleQueryResult(TupleQueryResult tqr)
                        throws QueryEvaluationException
Throws:
QueryEvaluationException
Method Detail

getBindingNames

public List<String> getBindingNames()
Description copied from interface: TupleQueryResult
Gets the names of the bindings, in order of projection.

Specified by:
getBindingNames in interface TupleQueryResult
Returns:
The binding names, in order of projection.

size

public int size()

get

public BindingSet get(int index)

getIndex

public int getIndex()

setIndex

public void setIndex(int index)

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iteration<BindingSet,QueryEvaluationException>

next

public BindingSet next()
Specified by:
next in interface Iteration<BindingSet,QueryEvaluationException>

hasPrevious

public boolean hasPrevious()

previous

public BindingSet previous()

beforeFirst

public void beforeFirst()
Moves the cursor to the start of the query result, just before the first binding set. After calling this method, the result can be iterated over from scratch.


afterLast

public void afterLast()
Moves the cursor to the end of the query result, just after the last binding set.


insert

public void insert(BindingSet bindingSet)
Inserts the specified binding set into the list. The binding set is inserted immediately before the next element that would be returned by next(), if any, and after the next element that would be returned by previous(), if any. (If the table contains no binding sets, the new element becomes the sole element on the table.) The new element is inserted before the implicit cursor: a subsequent call to next() would be unaffected, and a subsequent call to previous() would return the new binding set.

Parameters:
bindingSet - The binding set to insert.

insert

public void insert(int index,
                   BindingSet bindingSet)

append

public void append(BindingSet bindingSet)

set

public void set(BindingSet bindingSet)

set

public BindingSet set(int index,
                      BindingSet bindingSet)

remove

public void remove()
Specified by:
remove in interface Iteration<BindingSet,QueryEvaluationException>

remove

public BindingSet remove(int index)

clear

public void clear()

close

public void close()
Specified by:
close in interface CloseableIteration<BindingSet,QueryEvaluationException>

clone

public MutableTupleQueryResult clone()
                              throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2001-2008 Aduna. All Rights Reserved.