@ApplicationScoped public class TriplestoreResourceService extends Object implements ResourceService
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_TRIPLESTORE_LDP_TYPE
The configuration key used to set whether the LDP type should be included in the body of the RDF.
|
static String |
CONFIG_TRIPLESTORE_RDF_LOCATION
The configuration key used to set where the RDF is stored.
|
| Constructor and Description |
|---|
TriplestoreResourceService()
Create a triplestore-backed resource service.
|
TriplestoreResourceService(RDFConnection rdfConnection)
Create a triplestore-backed resource service.
|
TriplestoreResourceService(RDFConnection rdfConnection,
IdentifierService identifierService)
Create a triplestore-backed resource service.
|
| Modifier and Type | Method and Description |
|---|---|
CompletionStage<Void> |
add(IRI id,
Dataset dataset) |
static RDFConnection |
buildRDFConnection(String location)
Build an RDF connection from a location value.
|
CompletionStage<Void> |
create(Metadata metadata,
Dataset dataset)
Create a resource in the server.
|
CompletionStage<Void> |
delete(Metadata metadata)
Delete a resource from the server.
|
String |
generateIdentifier()
An identifier generator.
|
CompletionStage<Resource> |
get(IRI identifier)
Get a resource by the given identifier.
|
void |
initialize()
This code is equivalent to the SPARQL queries below.
|
CompletionStage<Void> |
replace(Metadata metadata,
Dataset dataset)
Replace a resource in the server.
|
Set<IRI> |
supportedInteractionModels()
Return a collection of interaction models supported by this Resource Service.
|
CompletionStage<Void> |
touch(IRI identifier)
Update the modification date of the provided resource.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitskolemize, toExternal, toInternal, unskolemizepublic static final String CONFIG_TRIPLESTORE_RDF_LOCATION
public static final String CONFIG_TRIPLESTORE_LDP_TYPE
public TriplestoreResourceService()
public TriplestoreResourceService(RDFConnection rdfConnection)
rdfConnection - the connection to an RDF datastore@Inject public TriplestoreResourceService(RDFConnection rdfConnection, IdentifierService identifierService)
rdfConnection - the connection to an RDF datastoreidentifierService - an ID supplier servicepublic CompletionStage<Void> delete(Metadata metadata)
ResourceServicedelete in interface ResourceServicemetadata - metadata for the resourceCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public CompletionStage<Void> create(Metadata metadata, Dataset dataset)
ResourceServicecreate in interface ResourceServicemetadata - metadata for the new resourcedataset - the dataset to be persistedCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public CompletionStage<Void> replace(Metadata metadata, Dataset dataset)
ResourceServicereplace in interface ResourceServicemetadata - metadata for the resourcedataset - the dataset to be persistedCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.@PostConstruct public void initialize()
SELECT ?object WHERE {
GRAPH trellis:PreferServerManaged { IDENTIFIER rdf:type ?object }
}
INSERT DATA {
GRAPH trellis:PreferServerManaged {
IDENTIFIER rdf:type ldp:Container ;
dc:modified "NOW"^^xsd:dateTime }
GRAPH IDENTIFIER?ext=audit {
IDENTIFIER prov:wasGeneratedBy [
rdf:type prov:Activity , as:Create ;
prov:wasAssociatedWith trellis:AdministorAgent ;
prov:atTime "TIME"^^xsd:dateTime ] }
GRAPH IDENTIFIER?ext=acl {
IDENTIFIER acl:mode acl.Read , acl:Write , acl:Control ;
acl:agentClass foaf:Agent ;
acl:accessTo IDENTIFIER }
}
public CompletionStage<Resource> get(IRI identifier)
RetrievalServiceget in interface RetrievalService<Resource>identifier - the resource identifierpublic String generateIdentifier()
ResourceServicegenerateIdentifier in interface ResourceServicepublic CompletionStage<Void> add(IRI id, Dataset dataset)
add in interface ResourceServiceid - the identifier under which to persist a datasetdataset - a dataset to persistCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public CompletionStage<Void> touch(IRI identifier)
ResourceServicetouch in interface ResourceServiceidentifier - the identifier of the resourcepublic Set<IRI> supportedInteractionModels()
ResourceServicesupportedInteractionModels in interface ResourceServicepublic static RDFConnection buildRDFConnection(String location)
location - the location of the RDF