public class CoAPLDPResourceManager
extends java.lang.Object
Constructor and Description |
---|
CoAPLDPResourceManager(java.lang.String baseUri)
Creates an in-memory RDF repository.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandledNamespace(java.lang.String prefix,
java.lang.String namespace)
Adds a well-known namespace
|
void |
addNotPersistedProperty(java.lang.String p)
Adds a not-persisted property constraint
|
void |
addRDFBasicContainer(java.lang.String uri)
Adds the ldp:BasicContainer type to the resource
|
void |
addRDFContainer(java.lang.String uri)
Adds the ldp:Container type to the resource
|
void |
addRDFDirectContainer(java.lang.String uri)
Adds the ldp:DirectContainer type to the resource
|
void |
addRDFIndirectContainer(java.lang.String uri)
Adds the ldp:IndirectContainer type to the resource
|
void |
addRDFSource(java.lang.String uri)
Adds the ldp:RDFSource type to the resource
|
void |
addRDFSource(java.lang.String name,
java.lang.String type)
Adds a specific type to the resource
|
void |
addRDFStatement(org.eclipse.rdf4j.model.Resource s,
org.eclipse.rdf4j.model.IRI p,
org.eclipse.rdf4j.model.Value o)
Adds a single statement to the RDF repository
|
void |
addReadOnlyProperty(java.lang.String p)
Adds a read-only property constraint
|
void |
close()
Closes the RDF repository
|
org.eclipse.rdf4j.model.IRI |
createIRI(java.lang.String uri)
Creates an IRI from a string
|
void |
deleteMemberResourceStatement(java.lang.String name)
Deletes all LDP memberResource statements related to a specific resource
|
void |
deleteRDFBasicContainer(java.lang.String name)
Deletes all statements related to a specific LDP Basic Container
|
void |
deleteRDFDirectContainer(java.lang.String name)
Deletes all statements related to a specific LDP Direct Container
|
void |
deleteRDFSource(java.lang.String uri)
Deletes all statements related to a specific LDP RDF Source
|
java.lang.String |
getBaseURI()
Return the repository base URI
|
java.lang.String |
getconstrainedByURI()
Gets the LDP constrainedBy URI
|
java.lang.String |
getIsMemberOfRelation(java.lang.String rdf,
org.eclipse.rdf4j.rio.RDFFormat format)
Returns the isMemberOfRelation property contained in a set of RDF statements
|
java.lang.String |
getJSONLDResourceGraph(java.lang.String uri)
Returns the RDF graph associated to a resource in a JSON-LD serialization
|
java.lang.String |
getMemberRelation(java.lang.String rdf,
org.eclipse.rdf4j.rio.RDFFormat format)
Returns the memberRelation property contained in a set of RDF statements
|
java.lang.String |
getMemberResource(java.lang.String rdf,
org.eclipse.rdf4j.rio.RDFFormat format)
Returns the memberResource contained in a set of RDF statements
|
java.lang.String |
getTurtleResourceGraph(java.lang.String uri)
Returns the RDF graph associated to a resource in a Turtle serialization
|
java.lang.String |
getTurtleResourceGraph(java.lang.String uri,
java.util.List<java.lang.String> include,
java.util.List<java.lang.String> omit)
Returns the RDF graph associated to a resource in a Turtle serialization
|
boolean |
isDeleted(java.lang.String uri)
Verifies if a resource was previously deleted from the server
|
void |
patchResource(java.lang.String patch)
Applies PATCH request
|
java.lang.String |
postIndirectRDFSource(java.lang.String uri,
java.lang.String rdf,
java.lang.String rel,
org.eclipse.rdf4j.rio.RDFFormat format)
Creates a new RDF Source according to an LDP-CoAP POST request on an Indirect Container
|
void |
postRDFSource(java.lang.String uri,
java.lang.String rdf,
org.eclipse.rdf4j.rio.RDFFormat format)
Creates a new RDF Source according to an LDP-CoAP POST request on a Basic or Direct Container
|
void |
putRDFSource(java.lang.String name,
java.lang.String rdf,
org.eclipse.rdf4j.rio.RDFFormat format)
Creates/modifies a new RDF Source according to an LDP-CoAP PUT request on a Container
|
void |
removeHandledNamespace(java.lang.String prefix)
Removes a well-known namespace
|
void |
setConstrainedByURI(java.lang.String uri)
Sets the LDP constrainedBy URI
|
void |
setLDPContainsRelationship(java.lang.String resource,
java.lang.String container)
Adds the LDP contains statement
|
void |
setLDPInsertedContentRelation(java.lang.String container,
java.lang.String relation)
Adds the LDP insertedContentRelation statement
|
void |
setLDPInverseMemberRelation(java.lang.String container,
java.lang.String relation)
Adds the LDP inverseMemberRelation statement
|
void |
setLDPMemberRelation(java.lang.String container,
java.lang.String relation)
Adds the LDP memberRelation statement
|
void |
setLDPMembershipResource(java.lang.String resource,
java.lang.String container)
Adds the LDP membershipResource statement
|
void |
setRDFCreated(java.lang.String uri)
Adds the RDF created statement to the resource
|
void |
setRDFDescription(java.lang.String uri,
java.lang.String description)
Adds the RDF description statement to the resource
|
void |
setRDFStatement(java.lang.String s,
java.lang.String p,
double v)
Updates a single statement of the RDF repository
|
void |
setRDFStatement(java.lang.String s,
java.lang.String p,
java.lang.String o)
Updates a single statement of the RDF repository
|
void |
setRDFTitle(java.lang.String uri,
java.lang.String title)
Adds the RDF title statement to the resource
|
void |
updateRDFLiteralStatement(java.lang.String subj,
java.lang.String pred,
java.util.Date obj)
Updates a single statement of the RDF repository (object is a literal)
|
void |
updateRDFLiteralStatement(java.lang.String subj,
java.lang.String pred,
java.lang.Double obj)
Updates a single statement of the RDF repository (object is a literal)
|
void |
updateRDFStatement(java.lang.String subj,
java.lang.String pred,
java.lang.String obj)
Updates a single statement of the RDF repository
|
public CoAPLDPResourceManager(java.lang.String baseUri)
baseUri
- the repository base URIpublic java.lang.String getBaseURI()
public void addHandledNamespace(java.lang.String prefix, java.lang.String namespace)
prefix
- the namespace prefixnamespace
- the namespace URIpublic void removeHandledNamespace(java.lang.String prefix)
prefix
- the prefix of the namespace to be removedpublic void postRDFSource(java.lang.String uri, java.lang.String rdf, org.eclipse.rdf4j.rio.RDFFormat format) throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException, java.io.IOException, CoAPLDPException
uri
- the URI of the resource to be createdrdf
- the RDF text contained in the requestformat
- the RDF format of the request bodyorg.eclipse.rdf4j.rio.RDFParseException
org.eclipse.rdf4j.repository.RepositoryException
java.io.IOException
CoAPLDPException
public boolean isDeleted(java.lang.String uri)
uri
- the URI of the deleted resourcepublic java.lang.String postIndirectRDFSource(java.lang.String uri, java.lang.String rdf, java.lang.String rel, org.eclipse.rdf4j.rio.RDFFormat format) throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException, java.io.IOException, CoAPLDPException
uri
- the URI of the resource to be createdrdf
- the RDF text contained in the requestrel
- the insertedContentRelation property of the Indirect Containerformat
- the RDF format of the request bodyorg.eclipse.rdf4j.rio.RDFParseException
org.eclipse.rdf4j.repository.RepositoryException
java.io.IOException
CoAPLDPException
public java.lang.String getMemberRelation(java.lang.String rdf, org.eclipse.rdf4j.rio.RDFFormat format) throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.rio.UnsupportedRDFormatException, java.io.IOException
rdf
- the set of RDF statementsformat
- the RDF format of the input setorg.eclipse.rdf4j.rio.RDFParseException
org.eclipse.rdf4j.rio.UnsupportedRDFormatException
java.io.IOException
public java.lang.String getIsMemberOfRelation(java.lang.String rdf, org.eclipse.rdf4j.rio.RDFFormat format) throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.rio.UnsupportedRDFormatException, java.io.IOException
rdf
- the set of RDF statementsformat
- the RDF format of the input setorg.eclipse.rdf4j.rio.RDFParseException
org.eclipse.rdf4j.rio.UnsupportedRDFormatException
java.io.IOException
public java.lang.String getMemberResource(java.lang.String rdf, org.eclipse.rdf4j.rio.RDFFormat format) throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.rio.UnsupportedRDFormatException, java.io.IOException
rdf
- the set of RDF statementsformat
- the RDF format of the input setorg.eclipse.rdf4j.rio.RDFParseException
org.eclipse.rdf4j.rio.UnsupportedRDFormatException
java.io.IOException
public void putRDFSource(java.lang.String name, java.lang.String rdf, org.eclipse.rdf4j.rio.RDFFormat format) throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException, java.io.IOException, CoAPLDPException
uri
- the URI of the resource to be created/modifiedrdf
- the RDF text contained in the requestformat
- the RDF format of the request bodyorg.eclipse.rdf4j.rio.RDFParseException
org.eclipse.rdf4j.repository.RepositoryException
java.io.IOException
CoAPLDPException
public java.lang.String getTurtleResourceGraph(java.lang.String uri)
uri
- the URI of the resourcepublic java.lang.String getTurtleResourceGraph(java.lang.String uri, java.util.List<java.lang.String> include, java.util.List<java.lang.String> omit)
uri
- the URI of the resourceinclude
- the list of include preference headersomi
- the list of omit preference headerspublic java.lang.String getJSONLDResourceGraph(java.lang.String uri)
uri
- the URI of the resourcepublic void addRDFStatement(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o)
s
- the statement subjectp
- the statement predicateo
- the statement objectpublic void addRDFSource(java.lang.String uri)
uri
- the URI of the resourcepublic void addRDFSource(java.lang.String name, java.lang.String type)
uri
- the URI of the resourcetype
- the type of resourcepublic void close()
public void addRDFContainer(java.lang.String uri)
uri
- the URI of the resourcepublic void addRDFBasicContainer(java.lang.String uri)
uri
- the URI of the resourcepublic void addRDFDirectContainer(java.lang.String uri)
uri
- the URI of the resourcepublic void addRDFIndirectContainer(java.lang.String uri)
uri
- the URI of the resourcepublic void setRDFDescription(java.lang.String uri, java.lang.String description)
uri
- the URI of the resourcedescription
- the resource descriptionpublic void setRDFTitle(java.lang.String uri, java.lang.String title)
uri
- the URI of the resourcetitle
- the resource titlepublic void updateRDFStatement(java.lang.String subj, java.lang.String pred, java.lang.String obj)
subj
- the statement subjectpred
- the statement predicateobj
- the statement objectpublic void updateRDFLiteralStatement(java.lang.String subj, java.lang.String pred, java.lang.Double obj)
subj
- the statement subjectpred
- the statement predicateobj
- the statement object (a Double value)public void updateRDFLiteralStatement(java.lang.String subj, java.lang.String pred, java.util.Date obj)
subj
- the statement subjectpred
- the statement predicateobj
- the statement object (a Date value)public void setRDFCreated(java.lang.String uri)
uri
- the URI of the resourcepublic void setLDPContainsRelationship(java.lang.String resource, java.lang.String container)
resource
- the URI of the resourcecontainer
- the URI of the containerpublic void deleteRDFSource(java.lang.String uri)
uri
- the URI of the resourcepublic void deleteRDFBasicContainer(java.lang.String name)
uri
- the URI of the containerpublic void deleteRDFDirectContainer(java.lang.String name)
uri
- the URI of the containerpublic void setLDPMembershipResource(java.lang.String resource, java.lang.String container)
resource
- the URI of the resourcecontainer
- the URI of the containerpublic void setLDPMemberRelation(java.lang.String container, java.lang.String relation)
resource
- the URI of the resourcecontainer
- the URI of the containerpublic void setLDPInverseMemberRelation(java.lang.String container, java.lang.String relation)
resource
- the URI of the resourcecontainer
- the URI of the containerpublic void setLDPInsertedContentRelation(java.lang.String container, java.lang.String relation)
resource
- the URI of the resourcecontainer
- the URI of the containerpublic void setRDFStatement(java.lang.String s, java.lang.String p, java.lang.String o)
subj
- the statement subjectpred
- the statement predicateobj
- the statement objectpublic void setRDFStatement(java.lang.String s, java.lang.String p, double v)
subj
- the statement subjectpred
- the statement predicateobj
- the statement object (a Double value)public org.eclipse.rdf4j.model.IRI createIRI(java.lang.String uri)
uri
- the string URI to be convertedpublic void deleteMemberResourceStatement(java.lang.String name)
name
- the name of the resourcepublic void addReadOnlyProperty(java.lang.String p)
p
- the URI of the read-only propertypublic void addNotPersistedProperty(java.lang.String p)
p
- the URI of the not-persisted propertypublic void setConstrainedByURI(java.lang.String uri)
uri
- the URI of the LDP constrainedBy propertypublic java.lang.String getconstrainedByURI()
public void patchResource(java.lang.String patch) throws org.eclipse.rdf4j.repository.RepositoryException, org.apache.marmotta.platform.ldp.patch.parser.ParseException, org.apache.marmotta.platform.ldp.patch.InvalidPatchDocumentException
patch
- the RDF body of the patch requestorg.eclipse.rdf4j.repository.RepositoryException
org.apache.marmotta.platform.ldp.patch.parser.ParseException
org.apache.marmotta.platform.ldp.patch.InvalidPatchDocumentException