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.java.lang.String
getAnswerVariableName(int argumentIndex)
Returns the name of the answer variable for the given index.int
getArity()
Returns the arity (i.e., the number of columns) of the answers that the cursor computes.long
getCurrentMultiplicity()
Returns the multiplicity of the current tuple.long
getCurrentOffset()
Returns the offset of the current tuple.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.long
open(long skipToOffset)
Opens the cursor and positions it to the tuple with the given offset.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
-
getAnswerVariableName
Returns the name of the answer variable for the given index.- Parameters:
argumentIndex
- the index of the variable whose name is to be returned- Returns:
- the name of the variable at the given index
- Throws:
JRDFoxException
- thrown if an error is encountered
-
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
-
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
-
open
Opens the cursor and positions it to the tuple with the given offset. It is allowed to open the cursor more than once.- Parameters:
skipToOffset
- the offset of the tuple to which the cursor should be positioned- 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
-
getCurrentOffset
Returns the offset of the current tuple.- Returns:
- the offset of the current tuple
- Throws:
JRDFoxException
- thrown if an error is encountered
-
getCurrentMultiplicity
Returns the multiplicity of the current tuple.- Returns:
- the multiplicity of the current tuple
- 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
-