Module org.apache.jena.querybuilder
Class WhereHandler
java.lang.Object
org.apache.jena.arq.querybuilder.handlers.WhereHandler
- All Implemented Interfaces:
Handler
The where handler. Generally handles GroupGraphPattern.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a where handler with a new query.WhereHandler(org.apache.jena.query.Query query) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAll(WhereHandler whereHandler) Add all where attributes from the Where Handler argument.voidAdd a binding to the where clause.voidaddBind(org.apache.jena.sparql.expr.Expr expr, org.apache.jena.sparql.core.Var var) Add a binding to the where clause.voidAdd an expression string as a filter.voidaddFilter(org.apache.jena.sparql.expr.Expr expr) add an expression as a filter.voidaddGraph(org.apache.jena.graph.Node graph, Collection<org.apache.jena.sparql.core.TriplePath> subQuery) Add a graph to the where clause.voidaddGraph(org.apache.jena.graph.Node graph, WhereHandler subQuery) Add a graph to the where clause.voidaddGraph(org.apache.jena.graph.Node graph, org.apache.jena.sparql.core.TriplePath subQuery) Add a graph to the where clause.voidaddMinus(AbstractQueryBuilder<?> qb) Add a minus operation to the where clause.voidaddOptional(Collection<org.apache.jena.sparql.core.TriplePath> t) Add an optional triple to the where clausevoidaddOptional(WhereHandler whereHandler) Add the contents of a where handler as an optional statement.voidaddOptional(org.apache.jena.sparql.core.TriplePath t) Add an optional triple to the where clausevoidaddSubQuery(AbstractQueryBuilder<?> subQuery) Add a subquery to the where clause.voidaddUnion(AbstractQueryBuilder<?> subQuery) Add a union to the where clause.voidaddValueRow(org.apache.jena.shared.PrefixMapping prefixMapping, Object... values) voidaddValueRow(org.apache.jena.shared.PrefixMapping prefixMapping, Collection<?> values) voidaddValueVar(org.apache.jena.shared.PrefixMapping prefixMapping, Object var) voidaddValueVar(org.apache.jena.shared.PrefixMapping prefixMapping, Object var, Object... objects) <K extends Collection<?>>
voidaddValueVars(org.apache.jena.shared.PrefixMapping prefixMapping, Map<?, K> dataTable) voidaddWhere(Collection<org.apache.jena.sparql.core.TriplePath> t) Add the triple path to the where clausevoidaddWhere(ValuesHandler values) Add the triple path to the where clausevoidaddWhere(org.apache.jena.sparql.core.TriplePath t) Add the triple path to the where clausevoidbuild()Called by the build process for this handler to perform any adjustments to the query before the build completes.voidorg.apache.jena.sparql.syntax.ElementGroupGet the element group for the clause. if The element group is not set, create and set it.org.apache.jena.sparql.syntax.ElementGet the base element from the where clause.org.apache.jena.query.QuerygetQuery()org.apache.jena.sparql.syntax.ElementGet the query pattern from this where handler.List<org.apache.jena.sparql.core.Var>org.apache.jena.graph.NodeDeprecated.use {code Converters.makeCollection(List.of(Object...))}.org.apache.jena.sparql.syntax.ElementSubQuerymakeSubQuery(AbstractQueryBuilder<?> subQuery) Convert a subquery into a subquery element.voidSet the values for variables managed by the handler implementation.
-
Constructor Details
-
WhereHandler
public WhereHandler(org.apache.jena.query.Query query) Constructor.- Parameters:
query- The query to manipulate.
-
WhereHandler
public WhereHandler()Creates a where handler with a new query.
-
-
Method Details
-
getQueryPattern
public org.apache.jena.sparql.syntax.Element getQueryPattern()Get the query pattern from this where handler.- Returns:
- the query pattern
-
getQuery
public org.apache.jena.query.Query getQuery()- Returns:
- The query this where handler is using.
-
addAll
Add all where attributes from the Where Handler argument.- Parameters:
whereHandler- The Where Handler to copy from.
-
getElement
public org.apache.jena.sparql.syntax.Element getElement()Get the base element from the where clause. If the clause does not contain an element return the element group, otherwise return the enclosed element.- Returns:
- the base element.
-
getClause
public org.apache.jena.sparql.syntax.ElementGroup getClause()Get the element group for the clause. if The element group is not set, create and set it. Public for ExprFactory use.- Returns:
- The element group.
-
addWhere
Add the triple path to the where clause- Parameters:
t- The triple path to add.- Throws:
IllegalArgumentException- If the triple path is not a valid triple path for a where clause.
-
addWhere
public void addWhere(Collection<org.apache.jena.sparql.core.TriplePath> t) throws IllegalArgumentException Add the triple path to the where clause- Parameters:
t- The triple path to add.- Throws:
IllegalArgumentException- If the triple path is not a valid triple path for a where clause.
-
addWhere
Add the triple path to the where clause- Parameters:
values- The values to add to this where clause.- Throws:
IllegalArgumentException- If the triple path is not a valid triple path for a where clause.
-
addOptional
Add an optional triple to the where clause- Parameters:
t- The triple path to add.- Throws:
IllegalArgumentException- If the triple is not a valid triple for a where clause.
-
addOptional
public void addOptional(Collection<org.apache.jena.sparql.core.TriplePath> t) throws IllegalArgumentException Add an optional triple to the where clause- Parameters:
t- The triple path to add.- Throws:
IllegalArgumentException- If the triple is not a valid triple for a where clause.
-
addOptional
Add the contents of a where handler as an optional statement.- Parameters:
whereHandler- The where handler to use as the optional statement.
-
addFilter
Add an expression string as a filter.- Parameters:
expression- The expression string to add.
-
addFilter
public void addFilter(org.apache.jena.sparql.expr.Expr expr) add an expression as a filter.- Parameters:
expr- The expression to add.
-
addSubQuery
Add a subquery to the where clause.- Parameters:
subQuery- The sub query to add.
-
makeSubQuery
Convert a subquery into a subquery element.- Parameters:
subQuery- The sub query to convert- Returns:
- THe converted element.
-
addUnion
Add a union to the where clause.- Parameters:
subQuery- The subquery to add as the union.
-
addGraph
Add a graph to the where clause.- Parameters:
graph- The name of the graph.subQuery- The where handler that defines the graph.
-
addGraph
public void addGraph(org.apache.jena.graph.Node graph, org.apache.jena.sparql.core.TriplePath subQuery) Add a graph to the where clause. Short hand for graph { s, p, o }- Parameters:
graph- The name of the graph.subQuery- A triple path to add to the graph.
-
addGraph
public void addGraph(org.apache.jena.graph.Node graph, Collection<org.apache.jena.sparql.core.TriplePath> subQuery) Add a graph to the where clause. Short hand for graph { s, p, o }- Parameters:
graph- The name of the graph.subQuery- A triple path to add to the graph.
-
addBind
public void addBind(org.apache.jena.sparql.expr.Expr expr, org.apache.jena.sparql.core.Var var) Add a binding to the where clause.- Parameters:
expr- The expression to bind.var- The variable to bind it to.
-
addBind
Add a binding to the where clause.- Parameters:
expression- The expression to bind.var- The variable to bind it to.
-
setVars
Description copied from interface:HandlerSet the values for variables managed by the handler implementation. This method is called by the builder to set values handled by this Handler implementation. -
build
public void build()Description copied from interface:HandlerCalled by the build process for this handler to perform any adjustments to the query before the build completes. The adjustments are made after setVars() has been called. -
list
Deprecated.use {code Converters.makeCollection(List.of(Object...))}.Create a list node from a list of objects as per RDF Collections. http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#collections- Parameters:
objs- the list of objects for the list.- Returns:
- the first blank node in the list.
-
addMinus
Add a minus operation to the where clause. The prolog will be updated with the prefixes from the abstract query builder.- Parameters:
qb- the abstract builder that defines the data to subtract.
-
getValuesVars
-
getValuesMap
-
clearValues
public void clearValues()
-