Package com.complexible.stardog

# Interface StoredQueries

All Superinterfaces:
  `Iterable<StoredQuery>`

public interface StoredQueries extends Iterable<StoredQuery>
A mutable collection of stored queries.

Since:
  4.2
Version:
  5.0.2
Author:
  Evren Sirin, Michael Grove

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(StoredQuery query)`
  Stores the given query.
  `void`
  `clear()`
  Removes all the stored queries.
  `StoredQuery`
  `get(String name)`
  Returns the stored query with the given name.
  `Iterator<StoredQuery>`
  `iterator()`
  Returns an iterator of all stored queries.
  `Iterable<StoredQuery>`
  `list(Optional<String> db)`
  Lists all stored queries and if provided filter the stored queries for the given database name or the regular expression.
  `void`
  `move(String oldName, String newPath)`
  Moves the stored query to a different path.
  `void`
  `remove(String name)`
  Removes the stored query with the given name.
  `void`
  `rename(String oldName, String newName)`
  Renames the stored query.
  `void`
  `update(StoredQuery query)`
  Updates the stored query with the given name.

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Method Details

  - ### clear

    void clear() throws StardogException
    Removes all the stored queries.
    Throws:
      `StardogException` - if there is an error removing the queries

  - ### add

    void add(StoredQuery query) throws StardogException
    Stores the given query. If there is an existing stored query with the given name the request will fail.
    Parameters:
      `query` - the query being stored
    Throws:
      `com.complexible.stardog.server.QueryExistsException` - if there is an existing stored query with the given name
      `StardogException` - An error occurs while storing the query

  - ### update

    void update(StoredQuery query) throws StardogException
    Updates the stored query with the given name. If no query with the given name exists the given query is stored.
    Parameters:
      `query` - the query being updated
    Throws:
      `StardogException` - An error occurs while updating the query

  - ### get

    StoredQuery get(String name) throws StardogException
    Returns the stored query with the given name.
    Parameters:
      `name` - the name of the stored query being sought
    Returns:
      the stored query with the given name
    Throws:
      `com.complexible.stardog.server.QueryNotFoundException` - if the stored query with the given name does not exist
      `StardogException` - An error occurs while getting the query

  - ### iterator

    Iterator<StoredQuery> iterator()
    Returns an iterator of all stored queries. Users can only see their own stored queries and stored queries that have been shared by others.
    Specified by:
      `iterator` in interface `Iterable<StoredQuery>`
    Returns:
      iterator of all stored queries

  - ### list

    Iterable<StoredQuery> list(Optional<String> db)
    Lists all stored queries and if provided filter the stored queries for the given database name or the regular expression. If the db is not provided, all the stored queries that the user can access will be returned. Users can only see their own stored queries and stored queries that have been shared by others.
    Parameters:
      `db` - Name or regular expression to filter stored queries based on database
    Returns:
      iterator of all stored queries

  - ### remove

    void remove(String name) throws StardogException
    Removes the stored query with the given name.
    Parameters:
      `name` - the name of the stored query being removed
    Throws:
      `com.complexible.stardog.server.QueryNotFoundException` - if the stored query with the given name does not exist
      `StardogException` - An error occurs while removing the query

  - ### rename

    void rename(String oldName, String newName) throws StardogException
    Renames the stored query.
    Parameters:
      `oldName` - the name of the stored query being renamed
      `newName` - new name for the stored query
    Throws:
      `StardogException` - An error occurs while renaming the query

  - ### move

    void move(String oldName, String newPath) throws StardogException
    Moves the stored query to a different path. This is equivalent to removing the old query and creating a new query with the same name under a new path.
    Parameters:
      `oldName` - the name of the stored query being removed
      `newPath` - the path where the new stored query is created
    Throws:
      `StardogException`