Package com.stardog.stark.query.exec

# Interface QueryEngine

All Superinterfaces:
  `AutoCloseable`

public interface QueryEngine extends AutoCloseable

Interface for something that is able to execute and explain `queries`.

Since:
  1.0
Version:
  1.0
Author:
  Michael Grove

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close this query engine and free up any resources it holds
  `void`
  `exec(BooleanQuery theQuery, BooleanQueryResultHandler theHandler)`
  Execute the given `query`.
  `void`
  `exec(GraphQuery theQuery, RDFHandler theHandler)`
  Execute the given `query`.
  `void`
  `exec(SelectQuery theQuery, SelectQueryResultHandler theHandler)`
  Execute the given `query`.
  `void`
  `exec(UpdateQuery theQuery, Runnable theHandler)`
  Execute the given `query`.
  `QueryPlan`
  `explain(Query theQuery)`
  Explain the given `query`

- ## Method Details

  - ### close

    void close()
    Close this query engine and free up any resources it holds
    Specified by:
      `close` in interface `AutoCloseable`

  - ### exec

    void exec(@Nonnull SelectQuery theQuery, @Nonnull SelectQueryResultHandler theHandler) throws MalformedQuery, QueryExecutionFailure
    Execute the given `query`.
    Parameters:
      `theQuery` - the query to execute
    Throws:
      `QueryExecutionFailure` - if there is an error while executing the query
      `MalformedQuery` - The `Query` could be created such that it was not parsed initially and the executor will parse the query prior to execution
    Implementation Requirements:
      The query, if not already parsed, will first be parsed. Then the query will be executed, either synchronously or asynchronously, depending on the implementation of this `QueryEngine`. The results as they are computed will be forwarded to `theHandler`. Should any exception arise during execution it will be passed to `theErrorHandler` before execution is terminated; `theHandler` will receive no more results after `theErrorHandler` has been called.

  - ### exec

    void exec(@Nonnull GraphQuery theQuery, @Nonnull RDFHandler theHandler) throws MalformedQuery, QueryExecutionFailure
    Execute the given `query`.
    Parameters:
      `theQuery` - the query to execute
    Throws:
      `QueryExecutionFailure` - if there is an error while executing the query
      `MalformedQuery` - The `Query` could be created such that it was not parsed initially and the executor will parse the query prior to execution

  - ### exec

    void exec(@Nonnull BooleanQuery theQuery, @Nonnull BooleanQueryResultHandler theHandler) throws MalformedQuery, QueryExecutionFailure
    Execute the given `query`.
    Parameters:
      `theQuery` - the query to execute
    Throws:
      `QueryExecutionFailure` - if there is an error while executing the query
      `MalformedQuery` - The `Query` could be created such that it was not parsed initially and the executor will parse the query prior to execution

  - ### exec

    void exec(@Nonnull UpdateQuery theQuery, @Nonnull Runnable theHandler) throws MalformedQuery, QueryExecutionFailure
    Execute the given `query`.
    Parameters:
      `theQuery` - the query to execute
    Throws:
      `QueryExecutionFailure` - if there is an error while executing the query
      `MalformedQuery` - The `Query` could be created such that it was not parsed initially and the executor will parse the query prior to execution

  - ### explain

    @Nonnull QueryPlan explain(@Nonnull Query theQuery)
    Explain the given `query`
    Parameters:
      `theQuery` - the query to explain
    Returns:
      the query plan
    Throws:
      `MalformedQuery` - The `Query` could be created such that it was not parsed initially and the executor will parse the query prior to retrieving the plan