Class QueryExecApp

java.lang.Object
org.apache.jena.sparql.exec.QueryExecApp
All Implemented Interfaces:
AutoCloseable, QueryExec

public class QueryExecApp extends Object implements QueryExec
QueryExec that delays making the QueryExec until needed by a query operation This means timeouts and initialBinding can still be set via the QueryExecMod.
See Also:
  • Method Details

    • create

      public static QueryExec create(QueryExecMod qExec, DatasetGraph dataset, Query query, String queryString)
    • getBuilder

      public QueryExecMod getBuilder()
    • getDataset

      public DatasetGraph getDataset()
      Description copied from interface: QueryExec
      The dataset against which the query will execute. May be null - the dataset may be remote or the query itself has a dataset description.
      Specified by:
      getDataset in interface QueryExec
    • getContext

      public Context getContext()
      Description copied from interface: QueryExec
      The properties associated with a query execution - implementation specific parameters This includes Java objects (so it is not an RDF graph). Keys should be URIs as strings. May be null (this implementation does not provide any configuration).
      Specified by:
      getContext in interface QueryExec
    • getQuery

      public Query getQuery()
      Description copied from interface: QueryExec
      The query associated with a query execution. May be null (QueryExec may have been created by other means)
      Specified by:
      getQuery in interface QueryExec
    • getQueryString

      public String getQueryString()
      Description copied from interface: QueryExec
      The query as a string. This may be null (QueryExec may have been created by other means). This may contain non-Jena extensions and can not be parsed by Jena. If getQuery() is not null, this is a corresponding string that parses to the same query.
      Specified by:
      getQueryString in interface QueryExec
    • select

      public RowSet select()
      Description copied from interface: QueryExec
      Execute a SELECT query

      Important: The name of this method is somewhat of a misnomer in that depending on the underlying implementation this typically does not execute the SELECT query but rather answers a wrapper over an internal data structure that can be used to answer the query. In essence calling this method only returns a plan for executing this query which only gets evaluated when you actually start iterating over the results.

      Specified by:
      select in interface QueryExec
    • construct

      public org.apache.jena.graph.Graph construct(org.apache.jena.graph.Graph graph)
      Description copied from interface: QueryExec
      Execute a CONSTRUCT query, putting the statements into a graph.
      Specified by:
      construct in interface QueryExec
      Returns:
      Graph The graph argument for cascaded code.
    • constructTriples

      public Iterator<org.apache.jena.graph.Triple> constructTriples()
      Description copied from interface: QueryExec
      Execute a CONSTRUCT query, returning the results as an iterator of Triple.

      Caution: This method may return duplicate Triples. This method may be useful if you only need the results for stream processing, as it can avoid having to place the results in a Model.

      Important: The name of this method is somewhat of a misnomer in that depending on the underlying implementation this typically does not execute the CONSTRUCT query but rather answers a wrapper over an internal data structure that can be used to answer the query. In essence calling this method only returns a plan for executing this query which only gets evaluated when you actually start iterating over the results.

      Specified by:
      constructTriples in interface QueryExec
      Returns:
      An iterator of Triple objects (possibly containing duplicates) generated by applying the CONSTRUCT template of the query to the bindings in the WHERE clause.
    • constructQuads

      public Iterator<Quad> constructQuads()
      Description copied from interface: QueryExec
      Execute a CONSTRUCT query, returning the results as an iterator of Quad.

      Caution: This method may return duplicate Quads. This method may be useful if you only need the results for stream processing, as it can avoid having to place the results in a Model.

      See QueryExec.constructTriples() for usage and features.

      Specified by:
      constructQuads in interface QueryExec
      Returns:
      An iterator of Quad objects (possibly containing duplicates) generated by applying the CONSTRUCT template of the query to the bindings in the WHERE clause.
    • constructDataset

      public DatasetGraph constructDataset(DatasetGraph dataset)
      Description copied from interface: QueryExec
      Execute a CONSTRUCT query, putting the statements into 'dataset'. This may be an extended syntax query (if supported).
      Specified by:
      constructDataset in interface QueryExec
    • describe

      public org.apache.jena.graph.Graph describe(org.apache.jena.graph.Graph graph)
      Description copied from interface: QueryExec
      Execute a DESCRIBE query, putting the statements into a graph.
      Specified by:
      describe in interface QueryExec
      Returns:
      Graph The model argument for cascaded code.
    • describeTriples

      public Iterator<org.apache.jena.graph.Triple> describeTriples()
      Description copied from interface: QueryExec
      Execute a DESCRIBE query, returning the results as an iterator of Triple.

      Caution: This method may return duplicate Triples. This method may be useful if you only need the results for stream processing, as it can avoid having to place the results in a Model.

      Important: The name of this method is somewhat of a misnomer in that depending on the underlying implementation this typically does not execute the DESCRIBE query but rather answers a wrapper over an internal data structure that can be used to answer the query. In essence calling this method only returns a plan for executing this query which only gets evaluated when you actually start iterating over the results.

      Specified by:
      describeTriples in interface QueryExec
      Returns:
      An iterator of Triple objects (possibly containing duplicates) generated as the output of the DESCRIBE query.
    • ask

      public boolean ask()
      Description copied from interface: QueryExec
      Execute an ASK query
      Specified by:
      ask in interface QueryExec
    • execJson

      public JsonArray execJson()
      Description copied from interface: QueryExec
      Execute a JSON query and return a json array
      Specified by:
      execJson in interface QueryExec
    • execJsonItems

      public Iterator<JsonObject> execJsonItems()
      Description copied from interface: QueryExec
      Execute a JSON query and return an iterator
      Specified by:
      execJsonItems in interface QueryExec
    • abort

      public void abort()
      Description copied from interface: QueryExec
      Stop in mid execution. This method can be called in parallel with other methods on the QueryExecution object. There is no guarantee that the concrete implementation actual will stop or that it will do so immediately. No operations on the query execution or any associated result set are permitted after this call and may cause exceptions to be thrown.
      Specified by:
      abort in interface QueryExec
    • close

      public void close()
      Description copied from interface: QueryExec
      Close the query execution and stop query evaluation as soon as convenient. QExec objects, and a RowSet from QueryExec.select(), can not be used once the QExec is closed. Model results from QueryExec.construct() and QueryExec.describe() are still valid.

      It is important to close query execution objects in order to release resources such as working memory and to stop the query execution. Some storage subsystems require explicit ends of operations and this operation will cause those to be called where necessary. No operations on the query execution or any associated result set are permitted after this call.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface QueryExec
    • isClosed

      public boolean isClosed()
      Description copied from interface: QueryExec
      Answer whether this QueryExecution object has been closed or not.
      Specified by:
      isClosed in interface QueryExec
      Returns:
      boolean
    • timeout

      public void timeout(long timeout, TimeUnit timeoutUnits)
    • timeout

      public void timeout(long timeout)
    • timeout

      public void timeout(long timeout1, TimeUnit timeUnit1, long timeout2, TimeUnit timeUnit2)
    • timeout

      public void timeout(long timeout1, long timeout2)