Interface Getter


public interface Getter

Interface for retrieving statements from a Stardog database.

Usage:

// find a specific statement c.get().subject(s).predicate(p).object(o).statement(); // get all statements w/ a specific subject c.get().subject(s).iterator(); // get all statements w/ a specific predicate as a graph c.get().predicate(p).graph();
Since:
0.3
Version:
6.0
Author:
Michael Grove
  • Method Details

    • subject

      Getter subject(Resource theRes) throws StardogException
      Set the subject to get from the database
      Parameters:
      theRes - the subject
      Returns:
      this getter
      Throws:
      StardogException - if the subject is invalid
    • predicate

      Getter predicate(IRI theURI) throws StardogException
      Set the predicate to get from the database.
      Parameters:
      theURI - the predicate
      Returns:
      this getter
      Throws:
      StardogException - if the predicate is invalid
    • object

      Getter object(Value theObj) throws StardogException
      Set the object to get from the database
      Parameters:
      theObj - the object
      Returns:
      this getter
      Throws:
      StardogException - if the object is invalid
    • context

      Getter context(Resource theContext) throws StardogException
      Set the context to get from the database
      Parameters:
      theContext - the context
      Returns:
      this getter
      Throws:
      StardogException - if the subject is invalid
    • statements

      Stream<Statement> statements(Resource theSubj, IRI thePredicate, Value theObj, Resource theContext) throws StardogException
      Shortcut function for using statements(). Instead of having to set the subject, predicate, and/or object separately and then call iterator, you can get the statements directly. *NOTE* The `Stream` corresponds to a result set from the server and *MUST* be closed when no longer in use.
      Parameters:
      theSubj - the subject to get, or null for any
      thePredicate - the predicate to get, or null for any
      theObj - the object to get, or null for any
      theContext - the context to get, or null for any
      Returns:
      an iterator over the results of the get
      Throws:
      StardogException - if there is an error while retrieving the statements
    • ask

      boolean ask() throws StardogException
      Returns whether or not statements() returns any results, that is, whether or not there are any statements which match the current state of this Getter.
      Returns:
      true if there is at least one result or false if there are no results
      Throws:
      StardogException - if there is an error while retrieving the statement
    • ask

      boolean ask(Statement theStatement) throws StardogException
      Check to see if the statement exists in the database. Sugar for Getter.subject(theStatement.getSubject()) .predicate(theStatement.getPredicate()) .object(theStatement.getObject()) .context(theStatement.getContext()) .ask()
      Parameters:
      theStatement - the statement to check
      Returns:
      true if the statement is in the database, false otherwise
      Throws:
      StardogException
    • statements

      Stream<Statement> statements() throws StardogException
      Return the Stream of results resulting from the get operation. The caller should ensure that the BaseStream.close() method is called on the result to close any resources used to retrieve the statements.
      Returns:
      an iterator over the results
      Throws:
      StardogException - if there is an error while retrieving the statements
    • reasoning

      Getter reasoning(boolean theReasoningType)
      Sets the reasoning flag for this getter. If no reasoning flag is specified, the default reasoning flag of the connection will be used.
      Parameters:
      theReasoningType - the reasoning flag to use for the Getter
      Returns:
      this getter
    • reset

      void reset() throws StardogException
      Reset the state of this Getter
      Throws:
      StardogException - if there is an error while resetting the state of the getter, such as the connection is no longer open