Interface BindingSet

  • All Superinterfaces:
    java.lang.Iterable<Binding>

    public interface BindingSet
    extends java.lang.Iterable<Binding>

    A set of query result bindings

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

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.util.Optional<Binding> binding​(java.lang.String theVar)
      Optionally return the binding of the given variable
      boolean binds​(java.lang.String theVar)
      Return whether or not the variable is bound in this solution
      default java.util.Optional<BNode> bnode​(java.lang.String theVar)
      Optionally return the value for the given variable as a BNode
      default Value get​(java.lang.String theVar)
      Get the value for the given variable in the solution.
      default java.util.Optional<IRI> iri​(java.lang.String theVar)
      Optionally return the value for the given variable as a IRI
      default java.util.Optional<Literal> literal​(java.lang.String theVar)
      Optionally return the value for the given variable as a Literal
      default java.util.Optional<Resource> resource​(java.lang.String theVar)
      Optionally return the value for the given variable as a Resource
      int size()
      Return the number of bindings in the solution.
      default java.util.stream.Stream<Binding> stream()
      Return this set of bindings as a Stream
      java.util.Optional<Value> value​(java.lang.String theVar)
      Optionally return the value for the given variable
      java.util.Set<java.lang.String> variables()
      Return the set of variables associated with this `BindingSet`.
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
    • Method Detail

      • variables

        @Nonnull
        java.util.Set<java.lang.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
        java.util.Optional<Value> value​(@Nonnull
                                        java.lang.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
        default Value get​(@Nonnull
                          java.lang.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 java.util.Optional<Literal> literal​(@Nonnull
                                                    java.lang.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 java.util.Optional<IRI> iri​(@Nonnull
                                            java.lang.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 java.util.Optional<BNode> bnode​(@Nonnull
                                                java.lang.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 java.util.Optional<Resource> resource​(@Nonnull
                                                      java.lang.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
                      java.lang.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
        java.util.Optional<Binding> binding​(@Nonnull
                                            java.lang.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 java.util.stream.Stream<Binding> stream()
        Return this set of bindings as a Stream
        Returns:
        the `Stream` of bindings*