Package org.fcrepo.http.api.services
Class HttpRdfService
- java.lang.Object
-
- org.fcrepo.http.api.services.HttpRdfService
-
@Component public class HttpRdfService extends Object
A service that will translate the resourceURI to Fedora ID in the Rdf InputStream- Since:
- 2019-11-07
- Author:
- bseeger, bbpennel
-
-
Constructor Summary
Constructors Constructor Description HttpRdfService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.fcrepo.kernel.api.RdfStreambodyToExternalStream(String extResourceId, org.fcrepo.kernel.api.RdfStream stream, org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter idTranslator)Convert internal IDs to external URIsorg.apache.jena.rdf.model.ModelbodyToInternalModel(org.fcrepo.kernel.api.identifiers.FedoraId extResourceId, InputStream stream, javax.ws.rs.core.MediaType contentType, org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter idTranslator, boolean lenientHandling)Parse the request body to a Model, with the URI to Fedora ID translations done.protected static org.apache.jena.rdf.model.ModelparseBodyAsModel(InputStream requestBodyStream, javax.ws.rs.core.MediaType contentType, String extResourceId)Parse the request body as a Model.StringpatchRequestToInternalString(org.fcrepo.kernel.api.identifiers.FedoraId resourceId, String requestBody, org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter idTranslator)Takes a PATCH request body and translates any subjects and objects that are in the domain of the repository to use internal IDs.
-
-
-
Constructor Detail
-
HttpRdfService
public HttpRdfService()
-
-
Method Detail
-
bodyToExternalStream
public org.fcrepo.kernel.api.RdfStream bodyToExternalStream(String extResourceId, org.fcrepo.kernel.api.RdfStream stream, org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter idTranslator)
Convert internal IDs to external URIs- Parameters:
extResourceId- The external URI of the resource.stream- The RDF stream to be translated.idTranslator- The identifier converter.- Returns:
- a converted RDF Stream.
-
bodyToInternalModel
public org.apache.jena.rdf.model.Model bodyToInternalModel(org.fcrepo.kernel.api.identifiers.FedoraId extResourceId, InputStream stream, javax.ws.rs.core.MediaType contentType, org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter idTranslator, boolean lenientHandling) throws org.fcrepo.kernel.api.exception.RepositoryRuntimeException, javax.ws.rs.BadRequestException
Parse the request body to a Model, with the URI to Fedora ID translations done.- Parameters:
extResourceId- the external ID of the Fedora resourcestream- the input stream containing the RDFcontentType- the media type of the RDFidTranslator- the identifier convertlenientHandling- whether the request included a handling=lenient prefer header.- Returns:
- RdfStream containing triples from request body, with Fedora IDs in them
- Throws:
org.fcrepo.kernel.api.exception.MalformedRdfException- in case rdf json cannot be parsedjavax.ws.rs.BadRequestException- in the case where the RDF syntax is badorg.fcrepo.kernel.api.exception.RepositoryRuntimeException
-
patchRequestToInternalString
public String patchRequestToInternalString(org.fcrepo.kernel.api.identifiers.FedoraId resourceId, String requestBody, org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter idTranslator)
Takes a PATCH request body and translates any subjects and objects that are in the domain of the repository to use internal IDs.- Parameters:
resourceId- the internal ID of the current resource.requestBody- the request body.idTranslator- an ID converter for the current context.- Returns:
- the converted PATCH request.
-
parseBodyAsModel
protected static org.apache.jena.rdf.model.Model parseBodyAsModel(InputStream requestBodyStream, javax.ws.rs.core.MediaType contentType, String extResourceId) throws javax.ws.rs.BadRequestException, org.fcrepo.kernel.api.exception.RepositoryRuntimeException
Parse the request body as a Model.- Parameters:
requestBodyStream- rdf request bodycontentType- content type of bodyextResourceId- the external ID of the Fedora resource- Returns:
- Model containing triples from request body
- Throws:
org.fcrepo.kernel.api.exception.MalformedRdfException- in case rdf json cannot be parsedjavax.ws.rs.BadRequestException- in the case where the RDF syntax is badorg.fcrepo.kernel.api.exception.RepositoryRuntimeException
-
-