Interface Cursor
- All Superinterfaces:
java.lang.AutoCloseable
public interface Cursor
extends java.lang.AutoCloseable
Provides access to the results of a query. A cursor can be opened only if a read-only or a read/write transaction is active
on the data store connection that the cursor was created on.
-
Method Summary
Modifier and Type Method Description long
advance()
Advances the cursor and positions it to the next tuple.boolean
canAdvance()
Checks whetheradvance()
can be called to continue iteration.void
close()
Closes the cursor by freeing all resources associated with it.int
getArity()
Returns the arity (i.e., the number of columns) of the answers that the cursor computes.DataStoreConnection
getDataStoreConnection()
Returns the data store connection that this cursor is associated with.Resource
getResource(int argumentIndex)
Returns the resource by for the given index in the current answer row.ResourceValue
getResourceValue(int argumentIndex)
Returns the resource bound to the given index in the current answer row.long
open()
Opens the cursor and positions it to the first tuple.void
stop()
Stops this iterator by releasing all resources that the cursor might hold.
-
Method Details
-
getDataStoreConnection
Returns the data store connection that this cursor is associated with.- Returns:
- the data store connection that this cursor is associated with
- Throws:
JRDFoxException
- thrown if an error is encountered
-
getArity
Returns the arity (i.e., the number of columns) of the answers that the cursor computes.- Returns:
- the arity of the cursor's answers
- Throws:
JRDFoxException
- thrown if an error is encountered
-
open
Opens the cursor and positions it to the first tuple. It is allowed to open the cursor more than once.- Returns:
- the multiplicity of the first tuple (0 if there are no tuples)
- Throws:
JRDFoxException
- thrown if an error is encountered
-
canAdvance
Checks whetheradvance()
can be called to continue iteration. Iteration cannot be continued if the data store has changed since this cursor was opened.- Returns:
true
if the data store has not changed since this cursor was opened- Throws:
JRDFoxException
- thrown if an error is encountered
-
advance
Advances the cursor and positions it to the next tuple.- Returns:
- the multiplicity of the next tuple (0 if there are no more tuples)
- Throws:
JRDFoxException
- thrown if an error is encountered
-
stop
Stops this iterator by releasing all resources that the cursor might hold. This method should be called if a cursor is opened but not iterated to the end. It is called automatically afteradvance()
returns 0.- Throws:
JRDFoxException
- thrown if an error is encountered
-
close
void close()Closes the cursor by freeing all resources associated with it. Once a cursor is closed, it cannot be used any further.- Specified by:
close
in interfacejava.lang.AutoCloseable
-
getResourceValue
Returns the resource bound to the given index in the current answer row.- Parameters:
argumentIndex
- the index of the resource being returned- Returns:
- the resource at the given index, or
null
if the given index in the row is unbound - Throws:
JRDFoxException
- thrown if an error is encountered
-
getResource
Returns the resource by for the given index in the current answer row.- Parameters:
argumentIndex
- the index of the resource being returned- Returns:
- the resource corresponding to the given index, or
null
if the given index in the row is unbound - Throws:
JRDFoxException
- thrown if an error is encountered
-