public class WhereBuilder extends AbstractQueryBuilder<WhereBuilder> implements WhereClause<WhereBuilder>
Constructor and Description |
---|
WhereBuilder()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
WhereBuilder |
addBind(Expr expression,
Object var)
Add a bind statement to the query *
http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rGraphGraphPattern.
|
WhereBuilder |
addBind(String expression,
Object var)
Add a bind statement to the query
http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rGraphGraphPattern.
|
WhereBuilder |
addFilter(Expr expr)
Adds a filter to the where clause
Use ExprFactory or NodeValue static or the AbstractQueryBuilder.makeExpr
methods to create the expression.
|
WhereBuilder |
addFilter(String s)
Adds a filter to the where clause
|
WhereBuilder |
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.
|
WhereBuilder |
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.
|
WhereBuilder |
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.
|
WhereBuilder |
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.
|
WhereBuilder |
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.
|
WhereBuilder |
addMinus(AbstractQueryBuilder<?> t)
Add a minus clause to the query.
|
WhereBuilder |
addOptional(AbstractQueryBuilder<?> t)
Adds an optional group pattern to the where clause.
|
WhereBuilder |
addOptional(FrontsTriple t)
Adds an optional triple as to the where clause.
|
WhereBuilder |
addOptional(Object s,
Object p,
Object o)
Adds an optional triple or triple path to the where clause.
|
WhereBuilder |
addOptional(Triple t)
Adds an optional triple to the where clause.
|
WhereBuilder |
addOptional(TriplePath t)
Adds an optional triple path to the where clause.
|
WhereBuilder |
addSubQuery(AbstractQueryBuilder<?> subQuery)
Add a sub query.
|
WhereBuilder |
addUnion(AbstractQueryBuilder<?> subQuery)
Add a union.
|
WhereBuilder |
addWhere(FrontsTriple t)
Adds a triple to the where clause.
|
WhereBuilder |
addWhere(Object s,
Object p,
Object o)
Adds a triple or triple path to the where clause.
|
WhereBuilder |
addWhere(Triple t)
Adds a triple to the where clause.
|
WhereBuilder |
addWhere(TriplePath t)
Adds a triple path to the where clause.
|
WhereBuilder |
addWhereValueRow(Collection<?> values)
Add a collection of objects as row of values.
|
WhereBuilder |
addWhereValueRow(Object... values)
Add objects as a row of values.
|
WhereBuilder |
addWhereValueVar(Object var)
Add a variable or variable and values to the value statement.
|
WhereBuilder |
addWhereValueVar(Object var,
Object... values)
Add a variable and values to the value statement.
|
<K extends Collection<?>> |
addWhereValueVars(Map<?,K> dataTable)
Add a data table to the value statement.
|
WhereBuilder |
clearWhereValues()
Reset the values table in the where clause to the initial
undefined state.
|
HandlerBlock |
getHandlerBlock()
Get the HandlerBlock for this query builder.
|
Map<Var,List<Node>> |
getWhereValuesMap()
Get an unmodifiable map of vars from the where clause values and their values.
|
List<Var> |
getWhereValuesVars()
Get an unmodifiable list of vars from the where clause values in the order that they appear
in the values table.
|
Node |
list(Object... objs)
Create a list node from a list of objects as per RDF Collections.
|
String |
toString() |
addPrefix, addPrefix, addPrefix, addPrefixes, addPrefixes, addValueRow, addValueRow, addValueVar, addValueVar, addValueVars, addWhere, asSubQuery, build, buildString, checkVar, clearValues, clone, getExprFactory, getPrologHandler, getValuesHandler, getValuesMap, getValuesVars, getWhereHandler, makeExpr, makeNode, makeNode, makeNodeOrPath, makeTriplePath, makeValueNodes, makeValueNodes, makeVar, quote, rewrite, setBase, setBase, setVar, setVar
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addWhere, getWhereHandler
public WhereBuilder addWhere(Triple t)
WhereClause
addWhere
in interface WhereClause<WhereBuilder>
t
- The triple path to addpublic WhereBuilder addWhere(TriplePath t)
WhereClause
addWhere
in interface WhereClause<WhereBuilder>
t
- The triple path to addpublic WhereBuilder addWhere(FrontsTriple t)
WhereClause
addWhere
in interface WhereClause<WhereBuilder>
t
- The triple to addpublic WhereBuilder addWhere(Object s, Object p, Object o)
WhereClause
AbstractQueryBuilder.makeTriplePath(java.lang.Object, java.lang.Object, java.lang.Object)
for conversion of the
param values.addWhere
in interface WhereClause<WhereBuilder>
s
- The subject.p
- The predicate.o
- The object.public WhereBuilder addWhereValueVar(Object var)
WhereClause
addWhereValueVar
in interface WhereClause<WhereBuilder>
var
- The variable or collection to add.AbstractQueryBuilder.makeNode(Object)
,
AbstractQueryBuilder.makeVar(Object)
public WhereBuilder addWhereValueVar(Object var, Object... values)
WhereClause
addWhereValueVar
in interface WhereClause<WhereBuilder>
var
- The variable to add.values
- The values for the variableAbstractQueryBuilder.makeNode(Object)
,
AbstractQueryBuilder.makeVar(Object)
public <K extends Collection<?>> WhereBuilder addWhereValueVars(Map<?,K> dataTable)
WhereClause
addWhereValueVars
in interface WhereClause<WhereBuilder>
dataTable
- The data table to add.Each item in the value collection is converted into a node using makeNode() strategy except that null values are converted
to UNDEF.
If there are already values in the value statement the data table is adds as follows:
- If the variable already exists in the table the map values are appended to the list of values
- If the variable does not exist in the table and there are other variables defined, an appropriate
number of nulls is added to the front of the map values to create UNDEF entries for the existing rows
- If there are variables in the value statement that are not specified in the map additional UNDEF
entries are appended to them to account for new rows that are added.
,
AbstractQueryBuilder.makeNode(Object)
,
AbstractQueryBuilder.makeVar(Object)
public WhereBuilder addWhereValueRow(Object... values)
WhereClause
addWhereValueRow
in interface WhereClause<WhereBuilder>
values
- the collection of values to add.AbstractQueryBuilder.makeNode(Object)
public WhereBuilder addWhereValueRow(Collection<?> values)
WhereClause
addWhereValueRow
in interface WhereClause<WhereBuilder>
values
- the collection of values to add.AbstractQueryBuilder.makeNode(Object)
public List<Var> getWhereValuesVars()
WhereClause
getWhereValuesVars
in interface WhereClause<WhereBuilder>
public Map<Var,List<Node>> getWhereValuesMap()
WhereClause
getWhereValuesMap
in interface WhereClause<WhereBuilder>
public WhereBuilder clearWhereValues()
WhereClause
clearWhereValues
in interface WhereClause<WhereBuilder>
public WhereBuilder addOptional(TriplePath t)
WhereClause
addOptional
in interface WhereClause<WhereBuilder>
t
- The triple path to addpublic WhereBuilder addOptional(Triple t)
WhereClause
addOptional
in interface WhereClause<WhereBuilder>
t
- The triple to addpublic WhereBuilder addOptional(FrontsTriple t)
WhereClause
addOptional
in interface WhereClause<WhereBuilder>
t
- The triple to addpublic WhereBuilder addOptional(Object s, Object p, Object o)
WhereClause
AbstractQueryBuilder.makeTriplePath(java.lang.Object, java.lang.Object, java.lang.Object)
for conversion of the
param values.addOptional
in interface WhereClause<WhereBuilder>
s
- The subject.p
- The predicate.o
- The object.public WhereBuilder addOptional(AbstractQueryBuilder<?> t)
WhereClause
addOptional
in interface WhereClause<WhereBuilder>
t
- The select builder to add as an optional patternpublic WhereBuilder addFilter(Expr expr)
WhereClause
addFilter
in interface WhereClause<WhereBuilder>
expr
- the expression to evaluate for the filter.ExprFactory
,
NodeValue
,
AbstractQueryBuilder.makeExpr(String)
public WhereBuilder addFilter(String s) throws ParseException
WhereClause
addFilter
in interface WhereClause<WhereBuilder>
s
- the expression to evaluate for the filter.ParseException
- If the expression can not be parsed.public WhereBuilder addSubQuery(AbstractQueryBuilder<?> subQuery)
WhereClause
addSubQuery
in interface WhereClause<WhereBuilder>
subQuery
- The subquery as defined by a SelectBuilder.public WhereBuilder addUnion(AbstractQueryBuilder<?> subQuery)
WhereClause
addUnion
in interface WhereClause<WhereBuilder>
subQuery
- The union as defined by a SelectBuilder.public WhereBuilder addGraph(Object graph, AbstractQueryBuilder<?> subQuery)
WhereClause
AbstractQueryBuilder.makeNode(java.lang.Object)
for conversion of the graph
param.addGraph
in interface WhereClause<WhereBuilder>
graph
- The iri or variable identifying the graph.subQuery
- The graph to add.public WhereBuilder addGraph(Object graph, FrontsTriple triple)
WhereClause
AbstractQueryBuilder.makeNode(java.lang.Object)
for conversion of the graph
param.addGraph
in interface WhereClause<WhereBuilder>
graph
- The iri or variable identifying the graph.triple
- a single s, p, o triple for the query.public WhereBuilder addGraph(Object graph, Object subject, Object predicate, Object object)
WhereClause
AbstractQueryBuilder.makeNode(java.lang.Object)
for conversion of the graph
param.addGraph
in interface WhereClause<WhereBuilder>
graph
- The iri or variable identifying the graph.subject
- The subject for the graph querypredicate
- The predicate for the graph query.object
- The object for the graph query.public WhereBuilder addGraph(Object graph, Triple triple)
WhereClause
AbstractQueryBuilder.makeNode(java.lang.Object)
for conversion of the graph
param.addGraph
in interface WhereClause<WhereBuilder>
graph
- The iri or variable identifying the graph.triple
- a single triple for the query.public WhereBuilder addGraph(Object graph, TriplePath triplePath)
WhereClause
AbstractQueryBuilder.makeNode(java.lang.Object)
for conversion of the graph
param.addGraph
in interface WhereClause<WhereBuilder>
graph
- The iri or variable identifying the graph.triplePath
- a single triple path for the query.public WhereBuilder addBind(Expr expression, Object var)
WhereClause
addBind
in interface WhereClause<WhereBuilder>
expression
- The expression to bind to the var.var
- The variable to bind to.public WhereBuilder addBind(String expression, Object var) throws ParseException
WhereClause
addBind
in interface WhereClause<WhereBuilder>
expression
- The expression to bind to the var.var
- The variable to bind to.ParseException
public Node list(Object... objs)
WhereClause
AbstractQueryBuilder.makeNode(java.lang.Object)
for conversion of the param
values.
usage:
list
in interface WhereClause<WhereBuilder>
objs
- the list of objects for the list.public WhereBuilder addMinus(AbstractQueryBuilder<?> t)
WhereClause
addMinus
in interface WhereClause<WhereBuilder>
t
- The select builder to add as a minus patternpublic HandlerBlock getHandlerBlock()
AbstractQueryBuilder
getHandlerBlock
in class AbstractQueryBuilder<WhereBuilder>
public String toString()
toString
in class AbstractQueryBuilder<WhereBuilder>
Licensed under the Apache License, Version 2.0