Package org.eclipse.rdf4j.spring.support
Class RDF4JTemplate
java.lang.Object
org.eclipse.rdf4j.spring.support.RDF4JTemplate
- Since:
- 4.0.0
- Author:
- Florian Kleedorfer, Gabriel Pickl
-
Constructor Summary
ConstructorDescriptionRDF4JTemplate
(RepositoryConnectionFactory repositoryConnectionFactory, OperationInstantiator operationInstantiator, org.springframework.core.io.ResourceLoader resourceLoader, UUIDSource uuidSource) -
Method Summary
Modifier and TypeMethodDescription<T> T
void
associate
(IRI fromResource, IRI property, Collection<IRI> toResources, boolean deleteOtherOutgoing, boolean deleteOtherIcoming) void
void
Deletes the specified resource: all triples are deleted in whichid
is the subject or the object.void
delete
(IRI start, List<PropertyPath> propertyPaths) Deletes the specified resource and all resourcesR
reached via any of the specified property paths.void
Returns a UUID IRI (schema: 'urn:uuid').getStringSupplierFromResourceContent
(String resourceName) graphQuery
(Class<?> owner, String operationName, Supplier<String> queryStringSupplier) Uses a cachedGraphQuery
if one is available under the specifiedoperationName
for theRepositoryConnection
that is used, otherwise the query string is obtained from the specified supplier, a new GraphQuery is instantiated and cached for future calls to this method.graphQuery
(Class<?> owner, NamedSparqlSupplier namedSparqlSupplier) Uses the providedNamedSparqlSupplier
for callinggraphQuery(Class, String, Supplier)
.graphQuery
(String graphQueryString) Bypassing any caches, generates a new GraphQuery from the specified SPARQL string and returns a Builder for its evaluation.graphQueryFromResource
(Class<?> owner, String resourceName) Reads the query from the specified resource and provides it through a
ingraphQuery(Class, String, Supplier)
, using theresourceName
as theoperationName
.tupleQuery
(Class<?> owner, String operationName, Supplier<String> queryStringSupplier) Uses a cachedTupleQuery
if one is available under the specifiedoperationName
for theRepositoryConnection
that is used, otherwise the query string is obtained from the specified supplier, a new TupleQuery is instantiated and cached for future calls to this method.tupleQuery
(Class<?> owner, NamedSparqlSupplier namedSparqlSupplier) Uses the providedNamedSparqlSupplier
for callingtupleQuery(Class, String, Supplier)
.tupleQuery
(String queryString) Bypassing any caches, generates a new TupleQuery from the specified SPARQL string and returns a Builder for its evaluation.tupleQueryFromResource
(Class<?> owner, String resourceName) Reads the query from the specified resource and provides it through a
intupleQuery(Class, String, Supplier)
, using theresourceName
as theoperationName
.Uses a cachedUpdate
if one is available under the specifiedoperationName
for theRepositoryConnection
that is used, otherwise the query string is obtained from the specified supplier, a new Update is instantiated and cached for future calls to this method.update
(Class<?> owner, NamedSparqlSupplier namedSparqlSupplier) Uses the providedNamedSparqlSupplier
for callingupdate(Class, String, Supplier)
.Bypassing any caches, generates a new Update from the specified SPARQL string and returns a Builder for its execution.updateFromResource
(Class<?> owner, String resourceName) Reads the update from the specified resource and provides it through a
inupdate(Class, String, Supplier)
, using theresourceName
as theoperationName
.updateWithoutCachingStatement
(String updateString)
-
Constructor Details
-
RDF4JTemplate
public RDF4JTemplate(@Autowired RepositoryConnectionFactory repositoryConnectionFactory, @Autowired OperationInstantiator operationInstantiator, @Autowired org.springframework.core.io.ResourceLoader resourceLoader, @Autowired(required=false) UUIDSource uuidSource)
-
-
Method Details
-
consumeConnection
-
applyToConnection
-
update
Bypassing any caches, generates a new Update from the specified SPARQL string and returns a Builder for its execution. Should be avoided in favor of one of the methods that apply caching unless the update is not reusable. -
update
public UpdateExecutionBuilder update(Class<?> owner, String operationName, Supplier<String> updateStringSupplier) Uses a cachedUpdate
if one is available under the specifiedoperationName
for theRepositoryConnection
that is used, otherwise the query string is obtained from the specified supplier, a new Update is instantiated and cached for future calls to this method. Note: this call is equivalent toupdate(String)
if operation caching is disabled.- Parameters:
owner
- the class of the client requesting the update, used to generate a cache key in combination with the operation nameoperationName
- name of the operation that, within the scope of the client, identifies the updateupdateStringSupplier
- supplies the sparql of the update if needed
-
updateFromResource
Reads the update from the specified resource and provides it through a
inupdate(Class, String, Supplier)
, using theresourceName
as theoperationName
. -
update
Uses the providedNamedSparqlSupplier
for callingupdate(Class, String, Supplier)
. -
updateWithoutCachingStatement
-
updateWithBuilder
-
tupleQuery
Bypassing any caches, generates a new TupleQuery from the specified SPARQL string and returns a Builder for its evaluation. Should be avoided in favor of one of the methods that apply caching unless the query is not reusable. -
tupleQuery
public TupleQueryEvaluationBuilder tupleQuery(Class<?> owner, String operationName, Supplier<String> queryStringSupplier) Uses a cachedTupleQuery
if one is available under the specifiedoperationName
for theRepositoryConnection
that is used, otherwise the query string is obtained from the specified supplier, a new TupleQuery is instantiated and cached for future calls to this method. -
tupleQueryFromResource
Reads the query from the specified resource and provides it through a
intupleQuery(Class, String, Supplier)
, using theresourceName
as theoperationName
. -
tupleQuery
public TupleQueryEvaluationBuilder tupleQuery(Class<?> owner, NamedSparqlSupplier namedSparqlSupplier) Uses the providedNamedSparqlSupplier
for callingtupleQuery(Class, String, Supplier)
. -
graphQuery
Bypassing any caches, generates a new GraphQuery from the specified SPARQL string and returns a Builder for its evaluation. Should be avoided in favor of one of the methods that apply caching unless the query is not reusable. -
graphQuery
public GraphQueryEvaluationBuilder graphQuery(Class<?> owner, String operationName, Supplier<String> queryStringSupplier) Uses a cachedGraphQuery
if one is available under the specifiedoperationName
for theRepositoryConnection
that is used, otherwise the query string is obtained from the specified supplier, a new GraphQuery is instantiated and cached for future calls to this method. -
graphQueryFromResource
Reads the query from the specified resource and provides it through a
ingraphQuery(Class, String, Supplier)
, using theresourceName
as theoperationName
. -
graphQuery
public GraphQueryEvaluationBuilder graphQuery(Class<?> owner, NamedSparqlSupplier namedSparqlSupplier) Uses the providedNamedSparqlSupplier
for callinggraphQuery(Class, String, Supplier)
. -
deleteTriplesWithSubject
-
delete
Deletes the specified resource: all triples are deleted in whichid
is the subject or the object.- Parameters:
id
-
-
delete
Deletes the specified resource and all resourcesR
reached via any of the specified property paths. Deletion means that all triples are removed in whichstart
or any resource inR
are the subject or the object.- Parameters:
start
- the initial resource to be deletedpropertyPaths
- paths by which to reach more resources to be deleted.
-
associate
public void associate(IRI fromResource, IRI property, Collection<IRI> toResources, boolean deleteOtherOutgoing, boolean deleteOtherIcoming) -
getStringSupplierFromResourceContent
-
getNewUUID
Returns a UUID IRI (schema: 'urn:uuid'). Actual implementation depends on theuuidSource
that has been configured. SeeUUIDSource
andorg.eclipse.rdf4j.spring.uuidsource
for details.
-