public class UpdateBuilder extends Object
| Constructor and Description |
|---|
UpdateBuilder()
Creates an UpdateBuilder with an empty prefix mapping.
|
UpdateBuilder(PrefixMapping pMap)
Creates an UpdateBuilder with the specified PrefixMapping.
|
UpdateBuilder(PrologClause<?> prologClause)
Creates an UpdateBuilder with the prefixes defined in the prolog clause.
|
| Modifier and Type | Method and Description |
|---|---|
UpdateBuilder |
addAll(WhereHandler whereHandler)
Add all where attributes from the Where Handler argument.
|
UpdateBuilder |
addBind(Expr expression,
Object var)
Add a bind statement to the query *
http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rGraphGraphPattern.
|
UpdateBuilder |
addBind(Expr expr,
Var var)
Add a binding to the where clause.
|
UpdateBuilder |
addBind(String expression,
Object var)
Add a bind statement to the query
http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#rGraphGraphPattern.
|
UpdateBuilder |
addBind(String expression,
Var var)
Add a binding to the where clause.
|
UpdateBuilder |
addDelete(AbstractQueryBuilder<?> queryBuilder)
Add the statements from the where clause in the specified query builder
to the delete statement.
|
UpdateBuilder |
addDelete(Collection<Triple> collection)
Add all triples to the delete statement.
|
UpdateBuilder |
addDelete(Iterator<Triple> iter)
Add all the triples in the iterator to the delete statement.
|
UpdateBuilder |
addDelete(Model model)
Add all the statements in the model to the delete statement.
|
UpdateBuilder |
addDelete(Object graph,
AbstractQueryBuilder<?> queryBuilder)
Add the statements from the where clause in the specified query builder
to the delete statements for the specified graph.
|
UpdateBuilder |
addDelete(Object g,
Collection<Triple> collection)
Add all the statements in the model to the delete statement.
|
UpdateBuilder |
addDelete(Object g,
Iterator<Triple> iter)
Add all the statements in the model to the delete statement.
|
UpdateBuilder |
addDelete(Object g,
Model model)
Add all the statements in the model a specified graph to the delete statement.
|
UpdateBuilder |
addDelete(Object s,
Object p,
Object o)
Add a triple to the delete statement.
|
UpdateBuilder |
addDelete(Object g,
Object s,
Object p,
Object o)
Add a quad to the delete statement.
|
UpdateBuilder |
addDelete(Object g,
Triple t)
Add a triple to the delete statement.
|
UpdateBuilder |
addDelete(Quad quad)
Add a quad to the delete statement.
|
UpdateBuilder |
addDelete(Triple t)
Add a triple to the delete statement.
|
UpdateBuilder |
addDeleteQuads(Collection<Quad> collection)
Add all the quads collection to the delete statement.
|
UpdateBuilder |
addFilter(Expr expression)
Adds a filter to the where clause
Use ExprFactory or NodeValue static or the AbstractQueryBuilder.makeExpr
methods to create the expression.
|
UpdateBuilder |
addFilter(String expression)
Add an expression string as a filter.
|
UpdateBuilder |
addGraph(Node graph,
WhereHandler subQuery)
Add a graph to the where clause.
|
UpdateBuilder |
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.
|
UpdateBuilder |
addInsert(AbstractQueryBuilder<?> queryBuilder)
Add the statements from the where clause in the specified query builder
to the insert statement.
|
UpdateBuilder |
addInsert(Collection<Triple> collection)
Add all the triples in the model to the insert statement.
|
UpdateBuilder |
addInsert(Iterator<Triple> iter)
Add all the triples to the insert statement.
|
UpdateBuilder |
addInsert(Model model)
Add all the statements in the model to the insert statement.
|
UpdateBuilder |
addInsert(Object graph,
AbstractQueryBuilder<?> queryBuilder)
Add the statements from the where clause in the specified query builder
to the insert statements for the specified graph.
|
UpdateBuilder |
addInsert(Object g,
Collection<Triple> collection)
Add triples to the insert statement.
|
UpdateBuilder |
addInsert(Object g,
Iterator<Triple> iter)
Add triples to the insert statement.
|
UpdateBuilder |
addInsert(Object g,
Model model)
Add all the statements in the model a specified graph to the insert statement.
|
UpdateBuilder |
addInsert(Object s,
Object p,
Object o)
Add a triple to the insert statement.
|
UpdateBuilder |
addInsert(Object g,
Object s,
Object p,
Object o)
Add a quad to the insert statement.
|
UpdateBuilder |
addInsert(Object g,
Triple t)
Add a triple in a specified graph to the insert statement.
|
UpdateBuilder |
addInsert(Quad quad)
Add a quad to the insert statement.
|
UpdateBuilder |
addInsert(Triple t)
Add a triple to the insert statement.
|
UpdateBuilder |
addInsertQuads(Collection<Quad> collection)
Add all the quads in the collection to the insert statement.
|
UpdateBuilder |
addMinus(AbstractQueryBuilder<?> t)
Add a minus clause to the query.
|
UpdateBuilder |
addOptional(AbstractQueryBuilder<?> t)
Adds an optional group pattern to the where clause.
|
UpdateBuilder |
addOptional(FrontsTriple t)
Adds an optional triple as to the where clause.
|
UpdateBuilder |
addOptional(Object s,
Object p,
Object o)
Adds an optional triple or triple path to the where clause.
|
UpdateBuilder |
addOptional(Triple t)
Adds an optional triple to the where clause.
|
UpdateBuilder |
addOptional(TriplePath t)
Add an optional triple to the where clause
|
UpdateBuilder |
addOptional(WhereHandler whereHandler)
Add the contents of a where handler as an optional statement.
|
UpdateBuilder |
addPrefix(String pfx,
Node uri)
Add the prefix to the prefix mapping.
|
UpdateBuilder |
addPrefix(String pfx,
Resource uri)
Add the prefix to the prefix mapping.
|
UpdateBuilder |
addPrefix(String pfx,
String uri)
Add the prefix to the prefix mapping.
|
UpdateBuilder |
addPrefixes(Map<String,String> prefixes)
Add the prefixes to the prefix mapping.
|
UpdateBuilder |
addPrefixes(PrefixMapping prefixes)
Add the prefixes to the prefix mapping.
|
UpdateBuilder |
addSubQuery(AbstractQueryBuilder<?> subQuery)
Add a subquery to the where clause.
|
UpdateBuilder |
addUnion(AbstractQueryBuilder<?> subQuery)
Add a union to the where clause.
|
UpdateBuilder |
addWhere(FrontsTriple t)
Adds a triple to the where clause.
|
UpdateBuilder |
addWhere(Object s,
Object p,
Object o)
Adds a triple or triple path to the where clause.
|
UpdateBuilder |
addWhere(Triple t)
Adds a triple to the where clause.
|
UpdateBuilder |
addWhere(TriplePath t)
Add the triple path to the where clause
|
UpdateBuilder |
addWhere(WhereClause<?> whereClause)
Add the WhereClause
|
UpdateRequest |
appendTo(UpdateRequest req)
Appends the new Update to the UpdateRequest.
|
Update |
build()
Build the update.
|
UpdateDeleteWhere |
buildDeleteWhere()
Create a DeleteWhere from the where clause.
|
UpdateDeleteWhere |
buildDeleteWhere(AbstractQueryBuilder<?> queryBuilder)
Create a DeleteWhere from the where clause.
|
UpdateRequest |
buildRequest()
Build as an UpdateRequest with prefix mapping set.
|
ExprFactory |
getExprFactory()
Get an ExprFactory that uses the prefixes from this builder.
|
Node |
list(Object... objs)
Create a list node from a list of objects as per RDF Collections.
|
Node |
makeNode(Object o)
Convert the object to a node.
|
TriplePath |
makeTriplePath(Object s,
Object p,
Object o)
Make a triple path from the objects.
|
Var |
makeVar(Object o)
Deprecated.
|
String |
quote(String s)
Deprecated.
Use quoted()
|
void |
setVar(Object var,
Object value)
Set a variable replacement.
|
void |
setVar(Var var,
Node value)
Set a variable replacement.
|
UpdateBuilder |
with(Object iri)
Specify the graph for all inserts and deletes.
|
public UpdateBuilder()
public UpdateBuilder(PrologClause<?> prologClause)
prologClause - the default prefixes for this builder.public UpdateBuilder(PrefixMapping pMap)
pMap - the prefix mapping to use.public Update build()
public UpdateRequest buildRequest()
public UpdateRequest appendTo(UpdateRequest req)
req - the UpdateRequest to append this Update to.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 Node makeNode(Object o)
o - the object to convert to a node.AbstractQueryBuilder.makeNode(Object)@Deprecated public Var makeVar(Object o)
Converters.makeVar(Object)o - the object to convert to a var.Converters.makeVar(Object)@Deprecated public String quote(String s)
s - the string to quote.Converters.quoted(String)public UpdateBuilder addInsert(Object g, Object s, Object p, Object o)
g - the graphs - the subjectp - the predicateo - the objectmakeNode(Object)public UpdateBuilder addInsert(Quad quad)
quad - the quad to add.public UpdateBuilder addInsert(Object s, Object p, Object o)
s - the subjectp - the predicateo - the objectmakeNode(Object)public UpdateBuilder addInsert(Triple t)
t - the triple to add.public UpdateBuilder addInsert(Object g, Triple t)
g - the graph for the triple.t - the triple to add.makeNode(Object)public UpdateBuilder addInsert(Model model)
model - The model to insert.public UpdateBuilder addInsert(Collection<Triple> collection)
collection - The triples to insert.Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addInsertQuads(Collection<Quad> collection)
collection - The quads to insert.public UpdateBuilder addInsert(Iterator<Triple> iter)
iter - The iterator of triples to insert.Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addInsert(Object g, Model model)
g - the graph for the triple.model - the model to add.makeNode(Object)public UpdateBuilder addInsert(Object g, Collection<Triple> collection)
g - the name of the graph to add the triples to.collection - The triples to insert.public UpdateBuilder addInsert(Object g, Iterator<Triple> iter)
g - the name of the graph to add the triples to.iter - The iterator of triples to insert.public UpdateBuilder addInsert(AbstractQueryBuilder<?> queryBuilder)
queryBuilder - The query builder to extract the where clause from.makeNode(Object),
Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addInsert(Object graph, AbstractQueryBuilder<?> queryBuilder)
graph - the graph to add the statements to.queryBuilder - The query builder to extract the where clause from.makeNode(Object)public UpdateBuilder addDelete(Object g, Object s, Object p, Object o)
g - the graphs - the subjectp - the predicateo - the objectmakeNode(Object)public UpdateBuilder addDelete(Quad quad)
quad - the quad to add.public UpdateBuilder addDeleteQuads(Collection<Quad> collection)
collection - The quads to insert.public UpdateBuilder addDelete(Object s, Object p, Object o)
s - the subjectp - the predicateo - the objectmakeNode(Object)public UpdateBuilder addDelete(Triple t)
t - the triple to add.Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addDelete(Object g, Triple t)
g - the graph for the triple.t - the triple to add.makeNode(Object)public UpdateBuilder addDelete(Model model)
model - The model to insert.Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addDelete(Collection<Triple> collection)
collection - The collection of triples to insert.Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addDelete(Iterator<Triple> iter)
iter - The iterator of triples to insert.Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addDelete(Object g, Model model)
g - the graph for the triples.model - the model to add.makeNode(Object)public UpdateBuilder addDelete(Object g, Collection<Triple> collection)
g - the graph for the triples.collection - The collection of triples to insert.public UpdateBuilder addDelete(Object g, Iterator<Triple> iter)
g - the graph for the triples.iter - The iterator of triples to insert.public UpdateBuilder addDelete(AbstractQueryBuilder<?> queryBuilder)
queryBuilder - The query builder to extract the where clause from.makeNode(Object),
Quad.defaultGraphNodeGeneratedpublic UpdateBuilder addDelete(Object graph, AbstractQueryBuilder<?> queryBuilder)
graph - the graph to add the statements to.queryBuilder - The query builder to extract the where clause from.makeNode(Object)public UpdateBuilder addPrefix(String pfx, Resource uri)
pfx - the prefix to add.uri - the uri for the prefix.public UpdateBuilder addPrefix(String pfx, Node uri)
pfx - the prefix to add.uri - the uri for the prefix.public UpdateBuilder addPrefix(String pfx, String uri)
pfx - the prefix to add.uri - the uri for the prefix.public UpdateBuilder addPrefixes(Map<String,String> prefixes)
prefixes - the prefixes to add.public UpdateBuilder addPrefixes(PrefixMapping prefixes)
prefixes - the prefix mapping to add.public ExprFactory getExprFactory()
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 UpdateBuilder addAll(WhereHandler whereHandler)
whereHandler - The Where Handler to copy from.public UpdateBuilder addWhere(TriplePath t) throws IllegalArgumentException
t - The triple path to add.IllegalArgumentException - If the triple path is not a valid triple path for a where
clause.public UpdateBuilder addWhere(WhereClause<?> whereClause) throws IllegalArgumentException
whereClause - IllegalArgumentException - If the triple path is not a valid triple path for a where
clause.public UpdateBuilder addOptional(TriplePath t) throws IllegalArgumentException
t - The triple path to add.IllegalArgumentException - If the triple is not a valid triple for a where clause.public UpdateBuilder addOptional(WhereHandler whereHandler)
whereHandler - The where handler to use as the optional statement.public UpdateBuilder addFilter(String expression) throws ParseException
expression - The expression string to add.ParseException - If the expression can not be parsed.public UpdateBuilder addSubQuery(AbstractQueryBuilder<?> subQuery)
subQuery - The sub query to add.public UpdateBuilder addUnion(AbstractQueryBuilder<?> subQuery)
subQuery - The subquery to add as the union.public UpdateBuilder addGraph(Node graph, WhereHandler subQuery)
graph - The name of the graph.subQuery - The where handler that defines the graph.public UpdateBuilder addBind(Expr expr, Var var)
expr - The expression to bind.var - The variable to bind it to.public UpdateBuilder addBind(String expression, Var var) throws ParseException
expression - The expression to bind.var - The variable to bind it to.ParseExceptionpublic Node list(Object... objs)
AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the param
values.
usage:
objs - the list of objects for the list.public UpdateBuilder addWhere(Triple t)
t - The triple path to addpublic UpdateBuilder addWhere(FrontsTriple t)
t - The triple to addpublic UpdateBuilder addWhere(Object s, Object p, Object o)
AbstractQueryBuilder.makeTriplePath(java.lang.Object, java.lang.Object, java.lang.Object) for conversion of the
param values.s - The subject.p - The predicate.o - The object.public UpdateBuilder addOptional(Triple t)
t - The triple to addpublic UpdateBuilder addOptional(FrontsTriple t)
t - The triple to addpublic UpdateBuilder addOptional(Object s, Object p, Object o)
AbstractQueryBuilder.makeTriplePath(java.lang.Object, java.lang.Object, java.lang.Object) for conversion of the
param values.s - The subject.p - The predicate.o - The object.public UpdateBuilder addOptional(AbstractQueryBuilder<?> t)
t - The select builder to add as an optional patternpublic UpdateBuilder addFilter(Expr expression)
expression - the expression to evaluate for the filter.ExprFactory,
NodeValue,
AbstractQueryBuilder.makeExpr(String)public UpdateBuilder addGraph(Object graph, AbstractQueryBuilder<?> subQuery)
AbstractQueryBuilder.makeNode(java.lang.Object) for conversion of the graph
param.graph - The iri or variable identifying the graph.subQuery - The graph to add.public UpdateBuilder addBind(Expr expression, Object var)
expression - The expression to bind to the var.var - The variable to bind to.public UpdateBuilder addBind(String expression, Object var) throws ParseException
expression - The expression to bind to the var.var - The variable to bind to.ParseExceptionpublic UpdateBuilder addMinus(AbstractQueryBuilder<?> t)
t - The select builder to add as a minus patternpublic UpdateBuilder with(Object iri)
iri - the IRI for the graph to use.public UpdateDeleteWhere buildDeleteWhere()
public UpdateDeleteWhere buildDeleteWhere(AbstractQueryBuilder<?> queryBuilder)
queryBuilder - the query builder to extract the where clause from.Licensed under the Apache License, Version 2.0