Package org.eclipse.rdf4j.spring.support.query

## Class DelegatingGraphQuery

- java.lang.Object
- - org.eclipse.rdf4j.spring.support.query.DelegatingGraphQuery

- All Implemented Interfaces:
    `GraphQuery`, `Operation`, `Query`
  Direct Known Subclasses:
    `LoggingGraphQuery`, `ResultCachingGraphQuery`

      public abstract class DelegatingGraphQuery
      extends Object
      implements GraphQuery

  Since:
    4.0.0
  Author:
    Florian Kleedorfer

- - ### Nested Class Summary

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

      `Query.QueryType`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DelegatingGraphQuery​(GraphQuery delegate)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clearBindings()` | Removes all previously set bindings.
    `GraphQueryResult` | `evaluate()` |
    `void` | `evaluate​(RDFHandler 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.
    `BindingSet` | `getBindings()` | Retrieves the bindings that have been set on this operation.
    `Dataset` | `getDataset()` | Gets the dataset that has been set using `Operation.setDataset(Dataset)`, if any.
    `protected GraphQuery` | `getDelegate()` |
    `boolean` | `getIncludeInferred()` | Returns whether or not this operation will return inferred statements (if any are present in the repository).
    `int` | `getMaxExecutionTime()` | Returns the maximum operation execution time.
    `int` | `getMaxQueryTime()` | Deprecated.
    `void` | `removeBinding​(String name)` | Removes a previously set binding on the supplied variable.
    `void` | `setBinding​(String name, Value value)` | Binds the specified variable to the supplied value.
    `void` | `setDataset​(Dataset dataset)` | Specifies the dataset against which to execute an operation, overriding any dataset that is specified in the operation itself.
    `void` | `setIncludeInferred​(boolean includeInferred)` | Determine whether evaluation results of this operation should include inferred statements (if any inferred statements are present in the repository).
    `void` | `setMaxExecutionTime​(int maxExecutionTimeSeconds)` | Specifies the maximum time that an operation is allowed to run.
    `void` | `setMaxQueryTime​(int maxQueryTime)` | Deprecated.
    `String` | `toString()` |

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

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

- - ### Constructor Detail

    - #### DelegatingGraphQuery

          public DelegatingGraphQuery​(GraphQuery delegate)

  - ### Method Detail

    - #### getDelegate

          protected GraphQuery getDelegate()

    - #### evaluate

          public GraphQueryResult evaluate()
                                    throws QueryEvaluationException

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

    - #### evaluate

          public void evaluate​(RDFHandler handler)
                        throws QueryEvaluationException,
                               RDFHandlerException

      Specified by:
        `evaluate` in interface `GraphQuery`
      Throws:
        `QueryEvaluationException`
        `RDFHandlerException`

    - #### setMaxQueryTime

          @Deprecated
          public void setMaxQueryTime​(int maxQueryTime)

      Deprecated.
      Description copied from interface: `Query`
      Specifies the maximum time that a query is allowed to run. The query will be interrupted when it exceeds the time limit. Any consecutive requests to fetch query results will result in `QueryInterruptedException`s.
      Specified by:
        `setMaxQueryTime` in interface `Query`
      Parameters:
        `maxQueryTime` - The maximum query time, measured in seconds. A negative or zero value indicates an unlimited query time (which is the default).

    - #### getMaxQueryTime

          @Deprecated
          public int getMaxQueryTime()

      Deprecated.
      Description copied from interface: `Query`
      Returns the maximum query evaluation time.
      Specified by:
        `getMaxQueryTime` in interface `Query`
      Returns:
        The maximum query evaluation time, measured in seconds.
      See Also:
        `Query.setMaxQueryTime(int)`

    - #### explain

          @Experimental
          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.

    - #### setBinding

          public void setBinding​(String name,
                                 Value value)

      Description copied from interface: `Operation`
      Binds the specified variable to the supplied value. Any value that was previously bound to the specified value will be overwritten.
      Specified by:
        `setBinding` in interface `Operation`
      Parameters:
        `name` - The name of the variable that should be bound.
        `value` - The (new) value for the specified variable.

    - #### removeBinding

          public void removeBinding​(String name)

      Description copied from interface: `Operation`
      Removes a previously set binding on the supplied variable. Calling this method with an unbound variable name has no effect.
      Specified by:
        `removeBinding` in interface `Operation`
      Parameters:
        `name` - The name of the variable from which the binding is to be removed.

    - #### clearBindings

          public void clearBindings()

      Description copied from interface: `Operation`
      Removes all previously set bindings.
      Specified by:
        `clearBindings` in interface `Operation`

    - #### getBindings

          public BindingSet getBindings()

      Description copied from interface: `Operation`
      Retrieves the bindings that have been set on this operation.
      Specified by:
        `getBindings` in interface `Operation`
      Returns:
        A (possibly empty) set of operation variable bindings.
      See Also:
        `Operation.setBinding(String, Value)`

    - #### setDataset

          public void setDataset​(Dataset dataset)

      Description copied from interface: `Operation`
      Specifies the dataset against which to execute an operation, overriding any dataset that is specified in the operation itself.
      Specified by:
        `setDataset` in interface `Operation`

    - #### getDataset

          public Dataset getDataset()

      Description copied from interface: `Operation`
      Gets the dataset that has been set using `Operation.setDataset(Dataset)`, if any.
      Specified by:
        `getDataset` in interface `Operation`

    - #### setIncludeInferred

          public void setIncludeInferred​(boolean includeInferred)

      Description copied from interface: `Operation`
      Determine whether evaluation results of this operation should include inferred statements (if any inferred statements are present in the repository). The default setting is 'true'.
      Specified by:
        `setIncludeInferred` in interface `Operation`
      Parameters:
        `includeInferred` - indicates whether inferred statements should be included in the result.

    - #### getIncludeInferred

          public boolean getIncludeInferred()

      Description copied from interface: `Operation`
      Returns whether or not this operation will return inferred statements (if any are present in the repository).
      Specified by:
        `getIncludeInferred` in interface `Operation`
      Returns:
        true if inferred statements will be returned, false otherwise.

    - #### setMaxExecutionTime

          public void setMaxExecutionTime​(int maxExecutionTimeSeconds)

      Description copied from interface: `Operation`
      Specifies the maximum time that an operation is allowed to run. The operation will be interrupted when it exceeds the time limit. Any consecutive requests to fetch query results will result in `QueryInterruptedException`s or `UpdateExecutionException`s (depending on whether the operation is a query or an update).
      Specified by:
        `setMaxExecutionTime` in interface `Operation`
      Parameters:
        `maxExecutionTimeSeconds` - The maximum query time, measured in seconds. A negative or zero value indicates an unlimited execution time (which is the default).

    - #### getMaxExecutionTime

          public int getMaxExecutionTime()

      Description copied from interface: `Operation`
      Returns the maximum operation execution time.
      Specified by:
        `getMaxExecutionTime` in interface `Operation`
      Returns:
        The maximum operation execution time, measured in seconds.
      See Also:
        `Operation.setMaxExecutionTime(int)`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`