T - The derived class type. Used for return types.public abstract class AbstractQueryBuilder<T extends AbstractQueryBuilder<T>> extends Object implements Cloneable, PrologClause<T>, ValuesClause<T>
| Modifier and Type | Method and Description |
|---|---|
T |
addPrefix(String pfx,
Node uri)
Adds a prefix.
|
T |
addPrefix(String pfx,
Resource uri)
Adds a prefix.
|
T |
addPrefix(String pfx,
String uri)
Adds a prefix.
|
T |
addPrefixes(Map<String,String> prefixes)
Adds prefixes.
|
T |
addPrefixes(PrefixMapping prefixMapping)
Adds prefixes.
|
T |
addValueRow(Collection<?> values)
Add a collection of objects as row of values.
|
T |
addValueRow(Object... values)
Add objects as a row of values.
|
T |
addValueVar(Object var)
Add a variable or variable and values to the value statement.
|
T |
addValueVar(Object var,
Object... objects)
Add a variable and values to the value statement.
|
<K extends Collection<?>> |
addValueVars(Map<?,K> dataTable)
Add a data table to the value statement.
|
T |
addWhere(AbstractQueryBuilder<?> whereClause)
Adds the contents of the whereClause to the where clause of this
builder.
|
ElementSubQuery |
asSubQuery() |
Query |
build()
Build the query.
|
String |
buildString()
Build the query as a string.
|
static Node |
checkVar(Node n)
Deprecated.
|
T |
clearValues()
Reset the values table to the initial undefined state.
|
static Query |
clone(Query q2)
Close the query.
|
ExprFactory |
getExprFactory()
Get the expression factory that works with the prefixes for this builder.
|
abstract HandlerBlock |
getHandlerBlock()
Get the HandlerBlock for this query builder.
|
PrologHandler |
getPrologHandler()
Get the prolog handler for this clause.
|
ValuesHandler |
getValuesHandler()
Get the value handler for this clause.
|
Map<Var,List<Node>> |
getValuesMap()
Get an unmodifiable map of vars and their values.
|
List<Var> |
getValuesVars()
Get an unmodifiable list of vars in the order that they appear in the values table.
|
WhereHandler |
getWhereHandler()
Gets the where handler used by this QueryBuilder.
|
Expr |
makeExpr(String expression)
A convenience method to make an expression from a string.
|
Node |
makeNode(Object o)
Make a Node from an object.
|
static Node |
makeNode(Object o,
PrefixMapping pMapping)
Deprecated.
|
static Object |
makeNodeOrPath(Object o,
PrefixMapping pMapping)
Deprecated.
|
TriplePath |
makeTriplePath(Object s,
Object p,
Object o)
Make a triple path from the objects.
|
Collection<Node> |
makeValueNodes(Iterator<?> iter)
Creates a collection of nodes from an iterator of Objects.
|
static Collection<Node> |
makeValueNodes(Iterator<?> iter,
PrefixMapping prefixMapping)
Deprecated.
|
static Var |
makeVar(Object o)
Deprecated.
|
static String |
quote(String q)
Deprecated.
|
static Query |
rewrite(Query q2,
Map<Var,Node> values)
Rewrite a query replacing variables as specified in the values map.
|
T |
setBase(Object base)
Sets the base URI.
|
T |
setBase(String base)
Sets the base URI.
|
void |
setVar(Object var,
Object value)
Set a variable replacement.
|
void |
setVar(Var var,
Node value)
Set a variable replacement.
|
String |
toString() |
public Node makeNode(Object o)
o - The object to convert. (may be null)@Deprecated public static Object makeNodeOrPath(Object o, PrefixMapping pMapping)
Converters.makeNodeOrPath(Object, PrefixMapping)o - the object that should be interpreted as a path or a node.pMapping - the prefix mapping to resolve path or node withpublic ElementSubQuery asSubQuery()
public TriplePath makeTriplePath(Object s, Object p, Object o)
predicate only will attempt to parse as a paths - The subject objectp - the predicate objecto - the object object.public Expr makeExpr(String expression) throws QueryParseException
expression - The expression to parse.QueryParseException - on error.@Deprecated public static String quote(String q)
Converters.quoted(String)q - the string to quote.
Will use single quotes if there are no single quotes in the string or if the
double quote is before the single quote in the string.
Will use double quote otherwise.@Deprecated public static Node checkVar(Node n)
Converters.checkVar(Node)n - the node to check@Deprecated public static Node makeNode(Object o, PrefixMapping pMapping)
Converters.makeNode(Object, PrefixMapping)o - The object to convert (may be null).pMapping - The prefix mapping to use for prefix resolution.@Deprecated public static Var makeVar(Object o) throws ARQInternalErrorException
Converters.makeVar(Object)o - The object to convert.ARQInternalErrorExceptionpublic abstract HandlerBlock getHandlerBlock()
public final PrologHandler getPrologHandler()
PrologClausegetPrologHandler in interface PrologClause<T extends AbstractQueryBuilder<T>>public ValuesHandler getValuesHandler()
ValuesClausegetValuesHandler in interface ValuesClause<T extends AbstractQueryBuilder<T>>public final WhereHandler getWhereHandler()
public final T addWhere(AbstractQueryBuilder<?> whereClause)
whereClause - the where clause to add.public final ExprFactory getExprFactory()
PrologClausegetExprFactory in interface PrologClause<T extends AbstractQueryBuilder<T>>public void setVar(Var var, Node value)
var - The variable to replacevalue - The value to replace it with or null to remove the
replacement.public void setVar(Object var, Object value)
makeVar(java.lang.Object) for conversion of the var param. See
makeNode(java.lang.Object) for conversion of the value param.var - The variable to replace.value - The value to replace it with or null to remove the
replacement.public T addPrefix(String pfx, Resource uri)
PrologClauseaddPrefix in interface PrologClause<T extends AbstractQueryBuilder<T>>pfx - The prefix.uri - The URI for the prefixpublic T addPrefix(String pfx, Node uri)
PrologClauseaddPrefix in interface PrologClause<T extends AbstractQueryBuilder<T>>pfx - The prefix.uri - The URI for the prefixpublic T addPrefix(String pfx, String uri)
PrologClauseaddPrefix in interface PrologClause<T extends AbstractQueryBuilder<T>>pfx - The prefix.uri - The URI for the prefixpublic T addPrefixes(Map<String,String> prefixes)
PrologClauseaddPrefixes in interface PrologClause<T extends AbstractQueryBuilder<T>>prefixes - A mapping of prefix to URI to add.public T addPrefixes(PrefixMapping prefixMapping)
PrologClauseaddPrefixes in interface PrologClause<T extends AbstractQueryBuilder<T>>prefixMapping - A PrefixMapping instance..public T setBase(String base)
PrologClausesetBase in interface PrologClause<T extends AbstractQueryBuilder<T>>base - The base URI to use.public T setBase(Object base)
PrologClausemakeNode(java.lang.Object) for conversion of the uri param. The resulting Node
must be a URI.setBase in interface PrologClause<T extends AbstractQueryBuilder<T>>base - The base URI to use.@Deprecated public static Collection<Node> makeValueNodes(Iterator<?> iter, PrefixMapping prefixMapping)
Converters.makeValueNodes(Iterator, PrefixMapping)iter - the iterator of objects, may be null or empty.prefixMapping - the PrefixMapping to use when nodes are created.public Collection<Node> makeValueNodes(Iterator<?> iter)
iter - the iterator of objects, may be null or empty.public T addValueVar(Object var)
ValuesClauseaddValueVar in interface ValuesClause<T extends AbstractQueryBuilder<T>>var - The variable or collection to add.makeNode(Object),
Converters.makeVar(Object)public T addValueVar(Object var, Object... objects)
ValuesClauseaddValueVar in interface ValuesClause<T extends AbstractQueryBuilder<T>>var - The variable to add.objects - The values for the variablemakeNode(Object),
Converters.makeVar(Object)public <K extends Collection<?>> T addValueVars(Map<?,K> dataTable)
ValuesClauseaddValueVars in interface ValuesClause<T extends AbstractQueryBuilder<T>>dataTable - The data table to add.makeNode(Object),
Converters.makeVar(Object)public T addValueRow(Object... values)
ValuesClauseaddValueRow in interface ValuesClause<T extends AbstractQueryBuilder<T>>values - the collection of values to add.makeNode(Object)public T addValueRow(Collection<?> values)
ValuesClauseaddValueRow in interface ValuesClause<T extends AbstractQueryBuilder<T>>values - the collection of values to add.makeNode(Object)public List<Var> getValuesVars()
ValuesClausegetValuesVars in interface ValuesClause<T extends AbstractQueryBuilder<T>>public Map<Var,List<Node>> getValuesMap()
ValuesClausegetValuesMap in interface ValuesClause<T extends AbstractQueryBuilder<T>>public T clearValues()
ValuesClauseclearValues in interface ValuesClause<T extends AbstractQueryBuilder<T>>public final String buildString()
public final Query build()
public static Query clone(Query q2)
q2 - The query to cloneLicensed under the Apache License, Version 2.0