lambdora-http-api/src/main/java/org/fcrepo/lambdora/ldp/LambdoraLdp.java
/**
     * Create a resource at a specified path, or replace triples with provided RDF.
     *
     * @param requestContentType the request content type
     * @param requestBodyStream  the request body stream
     * @param contentDisposition the content disposition value
     * @param ifMatch            the if-match value
     * @param links              the link values
     * @param digest             the digest header
     * @return 204
     * @throws InvalidChecksumException      if invalid checksum exception occurred
     * @throws MalformedRdfException         if malformed rdf exception occurred
     * @throws UnsupportedAlgorithmException
     */
Create a resource at a specified path, or replace triples with provided RDF.
Create a resource at a specified path or replace triples with provided RDF .
@PUT
    @Consumes
    public Response createOrReplaceObjectRdf(
        @HeaderParam(CONTENT_TYPE) final MediaType requestContentType,
        @ContentLocation final InputStream requestBodyStream,
        @HeaderParam(CONTENT_DISPOSITION) final ContentDisposition contentDisposition,
        @HeaderParam("If-Match") final String ifMatch,
        @HeaderParam(LINK) final List<String> links,
        @HeaderParam("Digest") final String digest)
        throws InvalidChecksumException, MalformedRdfException, UnsupportedAlgorithmException {
        final URI internalUri = createFromPath(externalPath);
        if (isRoot(internalUri)) {
            return Response.status(METHOD_NOT_ALLOWED).build();
        }
        final ContainerService containerService = getContainerService();
        if (!containerService.exists(internalUri)) {
            final Container container = containerService.findOrCreate(internalUri);
            final Model model = ModelFactory.createDefaultModel();
            model.read(requestBodyStream, null, "TTL");
            final Stream<Triple> triples = model.listStatements().toList().stream().map(Statement::asTriple);
            container.updateTriples(triples);
            return created(toExternalURI(container.getIdentifier(), headers)).build();
        } else {
            return noContent().build();
        }
    }
@ PUT @ Consumes public Response createOrReplaceObjectRdf ( @ HeaderParam ( CONTENT_TYPE ) final MediaType requestContentType , @ ContentLocation final InputStream requestBodyStream , @ HeaderParam ( CONTENT_DISPOSITION ) final ContentDisposition contentDisposition , @ HeaderParam ( "If-Match" ) final String ifMatch , @ HeaderParam ( LINK ) final List < String > links , @ HeaderParam ( "Digest" ) final String digest ) throws InvalidChecksumException , MalformedRdfException , UnsupportedAlgorithmException { final URI internalUri = createFromPath ( externalPath ) ; if ( isRoot ( internalUri ) ) { return Response . status ( METHOD_NOT_ALLOWED ) . build ( ) ; } final ContainerService containerService = getContainerService ( ) ; if ( ! containerService . exists ( internalUri ) ) { final Container container = containerService . findOrCreate ( internalUri ) ; final Model model = ModelFactory . createDefaultModel ( ) ; model . read ( requestBodyStream , null , "TTL" ) ; final Stream < Triple > triples = model . listStatements ( ) . toList ( ) . stream ( ) . map ( Statement :: asTriple ) ; container . updateTriples ( triples ) ; return created ( toExternalURI ( container . getIdentifier ( ) , headers ) ) . build ( ) ; } else { return noContent ( ) . build ( ) ; } }
Create a resource at a specified path, or replace triples with provided RDF.
Create a resource at a specified path or replace triples with provided RDF .
//method not allowed if root //create resource if exists //TODO delete resource, create resource, and update triples.