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 booleandoneprotected static AtomicIntegerNEXT_QUERY_IDprotected 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 voidabort()Mark the query as aborted and abort all scheduled (future) tasks known at this point in time.protected voidabortScheduledTasks()Abort any scheduled future tasksvoidclose()Close this query.booleanequals(Object obj)StringgetBaseURI()DatasetgetDataset()FederationContextgetFederationContext()booleangetIncludeInferred()longgetMaxRemainingTimeMS()StringgetQuery()BigIntegergetQueryID()QueryTypegetQueryType()Optional<TupleQueryResultHandler>getResultHandler()Returns aTupleQueryResultHandlerif this query is executed using.FederationEvalStrategygetStrategy()inthashCode()voidregisterScheduledTask(ParallelTask<?> task)Register a new scheduled task for this query.voidsetResultHandler(TupleQueryResultHandler resultHandler)Set theTupleQueryResultHandlerif 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- theFederationContextdataset- 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
FederationEvalStrategyactive in the current query context
-
getFederationContext
public FederationContext getFederationContext()
- Returns:
- the
FederationContextin 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 aTupleQueryResultHandlerif this query is executed using.TupleQuery.evaluate(TupleQueryResultHandler).- Returns:
- the
TupleQueryResultHandlerthat can be used for pass through - See Also:
PassThroughTupleExpr
-
setResultHandler
public void setResultHandler(TupleQueryResultHandler resultHandler)
Set theTupleQueryResultHandlerif 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
-
-