Package org.eclipse.rdf4j.repository.sparql.query

## Class SPARQLTupleQuery

- java.lang.Object
- - org.eclipse.rdf4j.query.impl.AbstractOperation
  - - org.eclipse.rdf4j.query.impl.AbstractQuery
    - - org.eclipse.rdf4j.http.client.query.AbstractHTTPQuery
      - - org.eclipse.rdf4j.repository.sparql.query.SPARQLTupleQuery

- All Implemented Interfaces:
    `Operation`, `Query`, `TupleQuery`

      public class SPARQLTupleQuery
      extends AbstractHTTPQuery
      implements TupleQuery

  Parses tuple results in the background.
  Author:
    James Leigh

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.rdf4j.query.Query

      `Query.QueryType`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.http.client.query.AbstractHTTPQuery

      `baseURI, queryLanguage, queryString`

    - ### Fields inherited from class org.eclipse.rdf4j.query.impl.AbstractOperation

      `bindings, dataset, includeInferred`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SPARQLTupleQuery​(SPARQLProtocolSession httpClient, String baseUri, String queryString)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `TupleQueryResult` | `evaluate()` |
    `void` | `evaluate​(TupleQueryResultHandler handler)` |
    `Explanation` | `explain​(Explanation.Level level)` | Explain how the query will be (or has been) executed/evaluated by returning an explanation of the query plan.

    - ### Methods inherited from class org.eclipse.rdf4j.http.client.query.AbstractHTTPQuery

      `getBindingsArray, getHttpClient, setMaxExecutionTime, toString`

    - ### Methods inherited from class org.eclipse.rdf4j.query.impl.AbstractQuery

      `getMaxQueryTime, setMaxQueryTime`

    - ### Methods inherited from class org.eclipse.rdf4j.query.impl.AbstractOperation

      `clearBindings, getBindings, getDataset, getIncludeInferred, getMaxExecutionTime, removeBinding, setBinding, setDataset, setIncludeInferred`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.query.Operation

      `clearBindings, getBindings, getDataset, getIncludeInferred, getMaxExecutionTime, removeBinding, setBinding, setDataset, setIncludeInferred, setMaxExecutionTime`

    - ### Methods inherited from interface org.eclipse.rdf4j.query.Query

      `getMaxQueryTime, setMaxQueryTime`

- - ### Constructor Detail

    - #### SPARQLTupleQuery

          public SPARQLTupleQuery​(SPARQLProtocolSession httpClient,
                                  String baseUri,
                                  String queryString)

  - ### Method Detail

    - #### evaluate

          public TupleQueryResult evaluate()
                                    throws QueryEvaluationException

      Specified by:
        `evaluate` in interface `TupleQuery`
      Throws:
        `QueryEvaluationException`

    - #### evaluate

          public void evaluate​(TupleQueryResultHandler handler)
                        throws QueryEvaluationException,
                               TupleQueryResultHandlerException

      Specified by:
        `evaluate` in interface `TupleQuery`
      Throws:
        `QueryEvaluationException`
        `TupleQueryResultHandlerException`

    - #### explain

          public Explanation explain​(Explanation.Level level)

      Description copied from interface: `Query`

      Explain how the query will be (or has been) executed/evaluated by returning an explanation of the query plan.

      This method is useful for understanding why a particular query is slow. The most useful level is Executed, but this takes as long as it takes to execute/evaluate the query.

      When timing a query you should keep in mind that the query performance will vary based on how much the JIT compiler has compiled the code (C1 vs C2) and based on what is or isn't cached in memory. If Timed explanations are considerably slower than Executed explanations the overhead with timing the query may be large on your system and should not be trusted.

      WARNING: This method is experimental and is subject to change or removal without warning. Same goes for the returned explanation. There is currently only partial support for this method in RDF4J and and UnsupportedOperationException where support is lacking.

      Specified by:
        `explain` in interface `Query`
      Parameters:
        `level` - The explanation level that should be used to create the explanation. Choose between: Unoptimized (as parsed without optimizations) , Optimized (as is actually going to be used), Executed (as was executed/evaluated, including some real performance metrics), Timed (as was executed/evaluated including all real performance metrics). Executed and Timed level can potentially be slow.
      Returns:
        The explanation that we generated, which can be viewed in a human readable format with toString(), as JSON or as a simplified query plan object structure.