Package com.complexible.stardog.api

# Interface ReadQuery<T>

All Superinterfaces:
  `Query<T>`

All Known Subinterfaces:
  `BooleanQuery`, `GraphQuery`, `PathQuery`, `SelectPlanQuery`, `SelectQuery`

public interface ReadQuery<T> extends Query<T>

A read-only query, ie a select, construct, graph or ask query.

Since:
  2.0
Version:
  6.0
Author:
  Michael Grove

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final long`
  `NO_LIMIT`
  Constant value used to specify that a query should not have any limit imposed on the number of results it returns.
  `static final long`
  `NO_OFFSET`
  Constant value used to specify that a query has no offset in its query results

  ### Fields inherited from interface com.complexible.stardog.api.Query

  `NO_ID, NO_TIMEOUT`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ReadQuery<T>`
  `dataset(Dataset theDataset)`
  Specify the dataset this query will be executed against.
  `InputStream`
  `execute(FileFormat theFormat)`
  Execute a query and return an input stream where the query results are serialized in the given file format.
  `default long`
  `limit()`
  `ReadQuery<T>`
  `limit(long theLimit)`
  Set the maximum number of results that can be returned by this query.
  `default long`
  `offset()`
  `ReadQuery<T>`
  `offset(long theOffset)`
  Set the offset of the query results.

  ### Methods inherited from interface com.complexible.stardog.api.Query

  `baseURI, dataset, execute, explain, explain, explain, getID, getSchema, hint, hints, id, isReasoningEnabled, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameter, parameters, queryString, reasoning, schema, timeout, timeout, toString`

- ## Field Details

  - ### NO_LIMIT

    static final long NO_LIMIT
    Constant value used to specify that a query should not have any limit imposed on the number of results it returns.
    See Also:
      - Constant Field Values

  - ### NO_OFFSET

    static final long NO_OFFSET
    Constant value used to specify that a query has no offset in its query results
    See Also:
      - Constant Field Values

- ## Method Details

  - ### execute

    InputStream execute(FileFormat theFormat) throws StardogException
    Execute a query and return an input stream where the query results are serialized in the given file format. This function is not supported for embedded connections.
    Parameters:
      `theFormat` - the result format
    Returns:
      query result serialization
    Throws:
      `StardogException` - if query execution fails

  - ### limit

    default long limit()

  - ### offset

    default long offset()

  - ### limit

    ReadQuery<T> limit(long theLimit)
    Set the maximum number of results that can be returned by this query. Setting the limit on the query will override any limit specified in the original query string, however, setting the limit to `NO_LIMIT` will not remove the limit if it is specified in the query, but you can use it to remove a limit that has already been set if there was not a limit specified in the query originally.
    Parameters:
      `theLimit` - the new limit
    Returns:
      this query

  - ### offset

    ReadQuery<T> offset(long theOffset)
    Set the offset of the query results. Similar to `limit()` this will override an offset in the query, and you can use `NO_OFFSET` to remove an offset specified on the query, but not in the query string.
    Parameters:
      `theOffset` - the offset
    Returns:
      this query

  - ### dataset

    ReadQuery<T> dataset(Dataset theDataset)
    Specify the dataset this query will be executed against. This defines the active graph for the query and will override anything specified within the query. Use `Datasets.NO_DATASET` remove the dataset.
    Specified by:
      `dataset` in interface `Query<T>`
    Parameters:
      `theDataset` - the active graph dataset
    Returns:
      this query
    See Also:
      - `Datasets`