org.eclipse.rdf4j.federated.structures

## 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 and Description
    --- | ---
    `protected boolean` | `done`
    `protected static AtomicInteger` | `NEXT_QUERY_ID`
    `protected Set<ParallelTask<?>>` | `scheduledSubtasks`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryInfo(Resource subj, IRI pred, Value obj, boolean includeInferred, FederationContext federationContext, Dataset dataset)`
    `QueryInfo(String query, QueryType queryType, boolean incluedInferred, FederationContext federationContext, Dataset dataset)`
    `QueryInfo(String query, String baseURI, QueryType queryType, int maxExecutionTime, boolean includeInferred, FederationContext federationContext, Dataset dataset)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 tasks
    `void` | `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 a `TupleQueryResultHandler` if this query is executed using.
    `int` | `hashCode()`
    `void` | `registerScheduledTask(ParallelTask<?> task)` Register a new scheduled task for this query.
    `void` | `setResultHandler(TupleQueryResultHandler resultHandler)` Set the `TupleQueryResultHandler` if the query is executed using `TupleQuery.evaluate(TupleQueryResultHandler)` allowing for passing through results to the handler.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### 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,
                           QueryType queryType,
                           boolean incluedInferred,
                           FederationContext federationContext,
                           Dataset dataset)

    - #### QueryInfo

          public QueryInfo(String query,
                           String baseURI,
                           QueryType queryType,
                           int maxExecutionTime,
                           boolean includeInferred,
                           FederationContext federationContext,
                           Dataset dataset)

      Parameters:
        `query` -
        `queryType` -
        `maxExecutionTime` - the maximum explicit query time in seconds, if 0 use `FedXConfig.getEnforceMaxQueryTime()`
        `includeInferred` - whether to include inferred statements
        `federationContext` - the `FederationContext`
        `dataset` - the `Dataset`

    - #### QueryInfo

          public QueryInfo(Resource subj,
                           IRI pred,
                           Value obj,
                           boolean includeInferred,
                           FederationContext federationContext,
                           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

    - #### 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 a `TupleQueryResultHandler` 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 the `TupleQueryResultHandler` if the query is executed using `TupleQuery.evaluate(TupleQueryResultHandler)` allowing for passing through results to the handler.
      Parameters:
        `resultHandler` - the `TupleQueryResultHandler`

    - #### 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

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.