Class QueryInfo
- java.lang.Object
-
- org.eclipse.rdf4j.federated.structures.QueryInfo
-
public class QueryInfo extends Object
Structure to maintain query information during evaluation, is attached to algebra nodes. Each instance is uniquely attached to the query.The queryId can be used to abort tasks belonging to a particular evaluation.
- Author:
- Andreas Schwarte
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
done
protected static AtomicInteger
NEXT_QUERY_ID
protected Set<ParallelTask<?>>
scheduledSubtasks
-
Constructor Summary
Constructors Constructor Description QueryInfo(String query, String baseURI, QueryType queryType, int maxExecutionTime, boolean includeInferred, FederationContext federationContext, FederationEvalStrategy strategy, Dataset dataset)
QueryInfo(Resource subj, IRI pred, Value obj, int maxExecutionTime, boolean includeInferred, FederationContext federationContext, FederationEvalStrategy strategy, Dataset dataset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
Mark the query as aborted and abort all scheduled (future) tasks known at this point in time.protected void
abortScheduledTasks()
Abort any scheduled future tasksvoid
close()
Close this query.boolean
equals(Object obj)
String
getBaseURI()
Dataset
getDataset()
FederationContext
getFederationContext()
boolean
getIncludeInferred()
long
getMaxRemainingTimeMS()
String
getQuery()
BigInteger
getQueryID()
QueryType
getQueryType()
Optional<TupleQueryResultHandler>
getResultHandler()
Returns aTupleQueryResultHandler
if this query is executed using.FederationEvalStrategy
getStrategy()
int
hashCode()
void
registerScheduledTask(ParallelTask<?> task)
Register a new scheduled task for this query.void
setResultHandler(TupleQueryResultHandler resultHandler)
Set theTupleQueryResultHandler
if the query is executed usingTupleQuery.evaluate(TupleQueryResultHandler)
allowing for passing through results to the handler.
-
-
-
Field Detail
-
NEXT_QUERY_ID
protected static final AtomicInteger NEXT_QUERY_ID
-
done
protected boolean done
-
scheduledSubtasks
protected Set<ParallelTask<?>> scheduledSubtasks
-
-
Constructor Detail
-
QueryInfo
public QueryInfo(String query, String baseURI, QueryType queryType, int maxExecutionTime, boolean includeInferred, FederationContext federationContext, FederationEvalStrategy strategy, Dataset dataset)
- Parameters:
query
-queryType
-maxExecutionTime
- the maximum explicit query time in seconds, if 0 useFedXConfig.getEnforceMaxQueryTime()
includeInferred
- whether to include inferred statementsfederationContext
- theFederationContext
dataset
- theDataset
-
QueryInfo
public QueryInfo(Resource subj, IRI pred, Value obj, int maxExecutionTime, boolean includeInferred, FederationContext federationContext, FederationEvalStrategy strategy, Dataset dataset)
-
-
Method Detail
-
getQueryID
public BigInteger getQueryID()
-
getQuery
public String getQuery()
-
getQueryType
public QueryType getQueryType()
-
getIncludeInferred
public boolean getIncludeInferred()
-
getDataset
public Dataset getDataset()
-
getBaseURI
public String getBaseURI()
- Returns:
- the baseURI
-
getStrategy
public FederationEvalStrategy getStrategy()
- Returns:
- the
FederationEvalStrategy
active in the current query context
-
getFederationContext
public FederationContext getFederationContext()
- Returns:
- the
FederationContext
in which this query is executed
-
getMaxRemainingTimeMS
public long getMaxRemainingTimeMS()
- Returns:
- the maximum remaining time in ms until the query runs into a timeout. If negative, timeout has been reached
-
registerScheduledTask
public void registerScheduledTask(ParallelTask<?> task) throws QueryEvaluationException
Register a new scheduled task for this query.- Parameters:
task
-- Throws:
QueryEvaluationException
- if the query has been aborted or closed
-
getResultHandler
public Optional<TupleQueryResultHandler> getResultHandler()
Returns aTupleQueryResultHandler
if this query is executed using.TupleQuery.evaluate(TupleQueryResultHandler)
.- Returns:
- the
TupleQueryResultHandler
that can be used for pass through - See Also:
PassThroughTupleExpr
-
setResultHandler
public void setResultHandler(TupleQueryResultHandler resultHandler)
Set theTupleQueryResultHandler
if the query is executed usingTupleQuery.evaluate(TupleQueryResultHandler)
allowing for passing through results to the handler.- Parameters:
resultHandler
- theTupleQueryResultHandler
-
abort
public void abort()
Mark the query as aborted and abort all scheduled (future) tasks known at this point in time. Also do not accept any new scheduled tasks
-
close
public void close()
Close this query. If exists, all scheduled (future) tasks known at this point in time are aborted. Also do not accept any new scheduled tasks
-
abortScheduledTasks
protected void abortScheduledTasks()
Abort any scheduled future tasks
-
-