Interface WhereClause<T extends AbstractQueryBuilder<T>>

Type Parameters:
T - The Builder type that the clause is part of.
All Known Implementing Classes:
AskBuilder, ConstructBuilder, DescribeBuilder, SelectBuilder, WhereBuilder

public interface WhereClause<T extends AbstractQueryBuilder<T>>
Interface that defines the WhereClause as per http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rWhereClause
  • Method Details

    • addWhere

      T addWhere(Triple t)
      Adds a triple to the where clause.
      Parameters:
      t - The triple to add
      Returns:
      This Builder for chaining.
    • addWhere

      T addWhere(TriplePath t)
      Adds a triple path to the where clause.
      Parameters:
      t - The triple path to add
      Returns:
      This Builder for chaining.
    • addWhere

      T addWhere(Collection<TriplePath> collection)
      Adds a collections of triple paths to the where clause.
      Parameters:
      collection - The collection of triple paths to add
      Returns:
      This Builder for chaining.
    • addWhere

      T addWhere(FrontsTriple t)
      Adds a triple to the where clause.
      Parameters:
      t - The triple to add
      Returns:
      This Builder for chaining.
    • addWhere

      T addWhere(Object s, Object p, Object o)
      Adds a triple or triple path to the where clause. See AbstractQueryBuilder.makeTriplePath(java.lang.Object, java.lang.Object, java.lang.Object) for conversion of the param values.
      Parameters:
      s - The subject.
      p - The predicate.
      o - The object.
      Returns:
      This Builder for chaining.
    • addWhere

      T addWhere(AbstractQueryBuilder<?> whereClause)
      Adds the elements from the whereClause to this where Clause.
      Parameters:
      whereClause - The whereClause to add to this statement.
      Returns:
      This Builder for chaining.
    • addWhereValueVar

      T addWhereValueVar(Object var)
      Add a variable or variable and values to the value statement. The first var (or first item in a collection) is converted to a variable using the makeVar strategy. A variable may be added multiple times, doing so will append values to the list of variable values. The order in which variables are added to the values table is preserved. Adding a collection as the var will use the first object in the collection as the var and the remaining objects as values. Values are created using makeNode() strategy except that null values are converted to UNDEF.
      Parameters:
      var - The variable or collection to add.
      Returns:
      The builder for chaining.
      See Also:
    • addWhereValueVar

      T addWhereValueVar(Object var, Object... values)
      Add a variable and values to the value statement. The var is converted to a variable using the makeVar strategy. A variable may be added multiple times, doing so will append values to the list of variable values. The order in which variables are added to the values table is preserved. Values are created using makeNode() strategy except that null values are converted to UNDEF.
      Parameters:
      var - The variable to add.
      values - The values for the variable
      Returns:
      The builder for chaining.
      See Also:
    • addWhereValueVars

      <K extends Collection<?>> T addWhereValueVars(Map<?,K> dataTable)
      Add a data table to the value statement. Each key in the map is used converted into a variable using the makeVar strategy. The order in which variables are added to the values table is preserved. Variables are added in the iteration order for the map. It may be advisable to use a LinkedHashMap to preserver the insert order.
      Parameters:
      dataTable - The data table to add.
      Returns:
      The builder for chaining.
      See Also:
    • addWhereValueRow

      T addWhereValueRow(Object... values)
      Add objects as a row of values. This method is different from the other methods in that the values are appended to each of the variables in the clause. There must be sufficient entries in the list to provide data for each variable in the table. Values objects are converted to nodes using the makeNode strategy. Variables will always be in the order added to the values table.
      Parameters:
      values - the collection of values to add.
      Returns:
      The builder for chaining.
      See Also:
    • addWhereValueRow

      T addWhereValueRow(Collection<?> values)
      Add a collection of objects as row of values. This method is different from the other methods in that the values are appended to each of the variables in the clause. There must be sufficient entries in the list to provide data for each variable in the table. Values objects are converted to nodes using the makeNode strategy. Variables will always be in the order added to the values table.
      Parameters:
      values - the collection of values to add.
      Returns:
      The builder for chaining.
      See Also:
    • getWhereValuesVars

      List<Var> getWhereValuesVars()
      Get an unmodifiable list of vars from the where clause values in the order that they appear in the values table.
      Returns:
      an unmodifiable list of vars.
    • getWhereValuesMap

      Map<Var,List<Node>> getWhereValuesMap()
      Get an unmodifiable map of vars from the where clause values and their values. Null values are considered as UNDEF values.
      Returns:
      an unmodifiable map of vars and their values.
    • clearWhereValues

      T clearWhereValues()
      Reset the values table in the where clause to the initial undefined state. Used primarily to reset the builder values table to a known state.
    • addOptional

      T addOptional(Triple t)
      Adds an optional triple to the where clause.
      Parameters:
      t - The triple to add
      Returns:
      This Builder for chaining.
    • addOptional

      T addOptional(TriplePath t)
      Adds an optional triple path to the where clause.
      Parameters:
      t - The triple path to add
      Returns:
      This Builder for chaining.
    • addOptional

      T addOptional(Collection<TriplePath> collection)
      Adds a collection of triple paths as the optional clauses.
      Parameters:
      collection - The collection of triple paths to add
      Returns:
      This Builder for chaining.
    • addOptional

      T addOptional(FrontsTriple t)
      Adds an optional triple as to the where clause.
      Parameters:
      t - The triple to add
      Returns:
      This Builder for chaining.
    • addOptional

      T addOptional(Object s, Object p, Object o)
      Adds an optional triple or triple path to the where clause. See AbstractQueryBuilder.makeTriplePath(java.lang.Object, java.lang.Object, java.lang.Object) for conversion of the param values.
      Parameters:
      s - The subject.
      p - The predicate.
      o - The object.
      Returns:
      This Builder for chaining.
    • addOptional

      T addOptional(AbstractQueryBuilder<?> t)
      Adds an optional group pattern to the where clause.
      Parameters:
      t - The select builder to add as an optional pattern
      Returns:
      This Builder for chaining.
    • addFilter

      T addFilter(String expression)
      Adds a filter to the where clause
      Parameters:
      expression - the expression to evaluate for the filter.
      Returns:
      This Builder for chaining.
    • addFilter

      T addFilter(Expr expression)
      Adds a filter to the where clause Use ExprFactory or NodeValue static or the AbstractQueryBuilder.makeExpr methods to create the expression.
      Parameters:
      expression - the expression to evaluate for the filter.
      Returns:
      This Builder for chaining.
      See Also:
    • addSubQuery

      T addSubQuery(AbstractQueryBuilder<?> subQuery)
      Add a sub query.
      Parameters:
      subQuery - The subquery as defined by a SelectBuilder.
      Returns:
      This builder for chaining.
    • addUnion

      T addUnion(AbstractQueryBuilder<?> union)
      Add a union.
      Parameters:
      union - The union as defined by a SelectBuilder.
      Returns:
      This builder for chaining.
    • addGraph

      T addGraph(Object graph, AbstractQueryBuilder<?> subQuery)
      Add a graph statement to the query as per http://www.w3.org/TR/2013/REC-sparql11 -query-20130321/#rGraphGraphPattern. See AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the graph param.
      Parameters:
      graph - The iri or variable identifying the graph.
      subQuery - The graph to add.
      Returns:
      This builder for chaining.
    • addGraph

      T addGraph(Object graph, FrontsTriple triple)
      Add a graph statement to the query as per http://www.w3.org/TR/2013/REC-sparql11 -query-20130321/#rGraphGraphPattern. See AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the graph param.
      Parameters:
      graph - The iri or variable identifying the graph.
      triple - a single s, p, o triple for the query.
      Returns:
      This builder for chaining.
    • addGraph

      T addGraph(Object graph, Object subject, Object predicate, Object object)
      Add a graph statement to the query as per http://www.w3.org/TR/2013/REC-sparql11 -query-20130321/#rGraphGraphPattern. See AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the graph param.
      Parameters:
      graph - The iri or variable identifying the graph.
      subject - The subject for the graph query
      predicate - The predicate for the graph query.
      object - The object for the graph query.
      Returns:
      This builder for chaining.
    • addGraph

      T addGraph(Object graph, Triple triple)
      Add a graph statement to the query as per http://www.w3.org/TR/2013/REC-sparql11 -query-20130321/#rGraphGraphPattern. See AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the graph param.
      Parameters:
      graph - The iri or variable identifying the graph.
      triple - a single triple for the query.
      Returns:
      This builder for chaining.
    • addGraph

      T addGraph(Object graph, TriplePath triplePath)
      Add a graph statement to the query as per http://www.w3.org/TR/2013/REC-sparql11 -query-20130321/#rGraphGraphPattern. See AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the graph param.
      Parameters:
      graph - The iri or variable identifying the graph.
      triplePath - a single triple path for the query.
      Returns:
      This builder for chaining.
    • addGraph

      T addGraph(Object graph, Collection<TriplePath> collection)
      Adds a collection of triple paths as the optional clauses.
      Parameters:
      graph - The iri or variable identifying the graph.
      collection - The collection of triple paths to add
      Returns:
      This Builder for chaining.
    • addBind

      T addBind(Expr expression, Object var)
      Add a bind statement to the query * http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rGraphGraphPattern.
      Parameters:
      expression - The expression to bind to the var.
      var - The variable to bind to.
      Returns:
      This builder for chaining.
    • addBind

      T addBind(String expression, Object var)
      Add a bind statement to the query http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rGraphGraphPattern.
      Parameters:
      expression - The expression to bind to the var.
      var - The variable to bind to.
      Returns:
      This builder for chaining.
    • getWhereHandler

      WhereHandler getWhereHandler()
      Get the Where handler for this clause.
      Returns:
      The WhereHandler used by this clause.
    • list

      @Deprecated(since="5.0.0") Node list(Object... objs)
      Deprecated.
      use addWhere(Converters.makeCollection(List.of(Object...))), or simply call addWhere(Object, Object, Object) passing the collection for one of the objects.
      Create a list node from a list of objects as per RDF Collections. http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#collections See AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the param values.

      usage:

      • list( param1, param2, param3, ... )
      • addWhere( list( param1, param2, param3, ... ), p, o )
      • addOptional( list( param1, param2, param3, ... ), p, o )
      Parameters:
      objs - the list of objects for the list.
      Returns:
      the first blank node in the list.
    • addMinus

      T addMinus(AbstractQueryBuilder<?> t)
      Add a minus clause to the query. https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rMinusGraphPattern
      Parameters:
      t - The select builder to add as a minus pattern
      Returns:
      this builder for chaining