Interface BindingSet

All Superinterfaces:
Iterable<Binding>

public interface BindingSet extends Iterable<Binding>

A set of query result bindings

Since:
1.0
Version:
1.0
Author:
Michael Grove
  • Method Details

    • variables

      @Nonnull Set<String> variables()
      Return the set of variables associated with this `BindingSet`. Minimally, this would be the names of all the bindings, however, it could be a superset of that and include the names of any variables which are not bound.
      Returns:
      the variable names
    • size

      int size()
      Return the number of bindings in the solution.
      Returns:
      the size
    • value

      @Nonnull Optional<Value> value(@Nonnull String theVar)
      Optionally return the value for the given variable
      Parameters:
      theVar - the name of the variable whose binding should be retrieved
      Returns:
      the value, or an empty optional if the var is not bound to a value or not in the solution
    • get

      @Nullable Value get(@Nonnull String theVar)
      Get the value for the given variable in the solution.
      Parameters:
      theVar - the name of the variable to get
      Returns:
      the value, or `null` if it is not bound
    • literal

      @Nonnull default Optional<Literal> literal(@Nonnull String theVar)
      Optionally return the value for the given variable as a Literal
      Parameters:
      theVar - the name of the variable whose binding should be retrieved
      Returns:
      the value as a `Literal`, or an empty optional if the var is not bound to a value or is not a `Literal`
    • iri

      @Nonnull default Optional<IRI> iri(@Nonnull String theVar)
      Optionally return the value for the given variable as a IRI
      Parameters:
      theVar - the name of the variable whose binding should be retrieved
      Returns:
      the value as a `IRI`, or an empty optional if the var is not bound to a value or is not a `IRI`
    • bnode

      @Nonnull default Optional<BNode> bnode(@Nonnull String theVar)
      Optionally return the value for the given variable as a BNode
      Parameters:
      theVar - the name of the variable whose binding should be retrieved
      Returns:
      the value as a `BNode`, or an empty optional if the var is not bound to a value or is not a `BNode`
    • resource

      @Nonnull default Optional<Resource> resource(@Nonnull String theVar)
      Optionally return the value for the given variable as a Resource
      Parameters:
      theVar - the name of the variable whose binding should be retrieved
      Returns:
      the value as a `Resource`, or an empty optional if the var is not bound to a value or is not a `Resource`
    • binds

      boolean binds(@Nonnull String theVar)
      Return whether or not the variable is bound in this solution
      Parameters:
      theVar - the var
      Returns:
      true if the variable is bound, false otherwise.
    • binding

      @Nonnull Optional<Binding> binding(@Nonnull String theVar)
      Optionally return the binding of the given variable
      Parameters:
      theVar - the variable name
      Returns:
      the binding of the var, or an empty optional if the var is not bound or not in the solution
    • stream

      @Nonnull default Stream<Binding> stream()
      Return this set of bindings as a Stream
      Returns:
      the `Stream` of bindings*