Class UpdateWithModelBuilder
- java.lang.Object
-
- org.eclipse.rdf4j.spring.dao.support.UpdateWithModelBuilder
-
public class UpdateWithModelBuilder extends Object
An
Operation
that holds aModel
internally and exposes aModelBuilder
for adding to it. Moreover it allows for deleting statements.Thus, the class provides a way of configuring an update to the repository incrementally, and no repository access happens until
Removing statements viaexecute()
is called. (unless the client usesapplyToConnection(Function)
and accesses the repository that way.)remove(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource...)
will remove them from the repository whenexecute()
is called; moreover, the statements will also be removed from the model at the time of theremove(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource...)
call, such that a subsequent creation of some of the deleted statements to the model will result in those triples being first deleted and then added to the repository whenexecute()
is called.- Since:
- 4.0.0
- Author:
- Florian Kleedorfer
-
-
Constructor Summary
Constructors Constructor Description UpdateWithModelBuilder(RepositoryConnection con)
-
Method Summary
-
-
-
Constructor Detail
-
UpdateWithModelBuilder
public UpdateWithModelBuilder(RepositoryConnection con)
-
-
Method Detail
-
fromTemplate
public static UpdateWithModelBuilder fromTemplate(RDF4JTemplate template)
-
remove
public UpdateWithModelBuilder remove(Resource subject, IRI predicate, Value object, Resource... resources)
Will remove statements upon update execution, before processing any additions. Statements that are removed here are also removed from the #addModel at the time of this call (not upon update execution)The semantics of
RepositoryConnection.remove(Iterable, Resource...)
apply, i.e. the resource(s) specified here are used there, if any.- Parameters:
subject
- the subject, or null to match any resourcepredicate
- the predicate, or null to match any IRIobject
- the object, or null to match any valueresources
- the context(s), if any- Returns:
- this builder
-
setNamespace
public UpdateWithModelBuilder setNamespace(Namespace ns)
-
setNamespace
public UpdateWithModelBuilder setNamespace(String prefix, String namespace)
-
subject
public UpdateWithModelBuilder subject(Resource subject)
-
subject
public UpdateWithModelBuilder subject(String prefixedNameOrIri)
-
namedGraph
public UpdateWithModelBuilder namedGraph(Resource namedGraph)
-
namedGraph
public UpdateWithModelBuilder namedGraph(String prefixedNameOrIRI)
-
defaultGraph
public UpdateWithModelBuilder defaultGraph()
-
addMaybe
public UpdateWithModelBuilder addMaybe(Resource subject, IRI predicate, Object object)
-
add
public UpdateWithModelBuilder add(Resource subject, IRI predicate, Object object)
-
addMaybe
public UpdateWithModelBuilder addMaybe(String subject, IRI predicate, Object object)
-
add
public UpdateWithModelBuilder add(String subject, IRI predicate, Object object)
-
addMaybe
public UpdateWithModelBuilder addMaybe(String subject, String predicate, Object object)
-
add
public UpdateWithModelBuilder add(String subject, String predicate, Object object)
-
addMaybe
public UpdateWithModelBuilder addMaybe(IRI predicate, Object object)
-
add
public UpdateWithModelBuilder add(IRI predicate, Object object)
-
addMaybe
public UpdateWithModelBuilder addMaybe(String predicate, Object object)
-
add
public UpdateWithModelBuilder add(String predicate, Object object)
-
acceptConnection
public void acceptConnection(Consumer<RepositoryConnection> connectionConsumer)
-
applyToConnection
public <T> T applyToConnection(Function<RepositoryConnection,T> function)
-
createBNode
public BNode createBNode()
-
withSink
public UpdateWithModelBuilder withSink(Consumer<Collection<Statement>> consumer)
-
execute
public void execute()
-
-