src/main/java/org/trellisldp/http/impl/DeleteHandler.java
/**
     * Delete the given resource
     * @param res the resource
     * @return a response builder
     */
Delete the given resource
@param res the resource
@return a response builder
Delete the given resource @param res the resource @return a response builder
public ResponseBuilder deleteResource(final Resource res) {
        final String baseUrl = getBaseUrl();
        final String identifier = baseUrl + req.getPartition() + req.getPath();
        final Session session = ofNullable(req.getSession()).orElseGet(HttpSession::new);
        checkDeleted(res, identifier);
        final EntityTag etag = new EntityTag(md5Hex(res.getModified() + identifier));
        checkCache(req.getRequest(), res.getModified(), etag);
        LOGGER.debug("Deleting {}", identifier);
        try (final TrellisDataset dataset = TrellisDataset.createDataset()) {
            audit.ifPresent(svc -> svc.deletion(res.getIdentifier(), session).stream()
                    .map(skolemizeQuads(resourceService, baseUrl)).forEachOrdered(dataset::add));
            if (ACL.equals(req.getExt())) {
                try (final Stream<? extends Triple> triples = res.stream(PreferUserManaged)) {
                    triples.map(t -> rdf.createQuad(PreferUserManaged, t.getSubject(), t.getPredicate(), t.getObject()))
                        .forEachOrdered(dataset::add);
                }
            }
            if (resourceService.put(res.getIdentifier(), dataset.asDataset())) {
                return status(NO_CONTENT);
            }
        }
        LOGGER.error("Unable to delete resource at {}", res.getIdentifier());
        return serverError().entity("Unable to delete resource. Please consult the logs for more information");
    }
public ResponseBuilder deleteResource ( final Resource res ) { final String baseUrl = getBaseUrl ( ) ; final String identifier = baseUrl + req . getPartition ( ) + req . getPath ( ) ; final Session session = ofNullable ( req . getSession ( ) ) . orElseGet ( HttpSession :: new ) ; checkDeleted ( res , identifier ) ; final EntityTag etag = new EntityTag ( md5Hex ( res . getModified ( ) + identifier ) ) ; checkCache ( req . getRequest ( ) , res . getModified ( ) , etag ) ; LOGGER . debug ( "Deleting {}" , identifier ) ; try ( final TrellisDataset dataset = TrellisDataset . createDataset ( ) ) { audit . ifPresent ( svc -> svc . deletion ( res . getIdentifier ( ) , session ) . stream ( ) . map ( skolemizeQuads ( resourceService , baseUrl ) ) . forEachOrdered ( dataset :: add ) ) ; if ( ACL . equals ( req . getExt ( ) ) ) { try ( final Stream < ? extends Triple > triples = res . stream ( PreferUserManaged ) ) { triples . map ( t -> rdf . createQuad ( PreferUserManaged , t . getSubject ( ) , t . getPredicate ( ) , t . getObject ( ) ) ) . forEachOrdered ( dataset :: add ) ; } } if ( resourceService . put ( res . getIdentifier ( ) , dataset . asDataset ( ) ) ) { return status ( NO_CONTENT ) ; } } LOGGER . error ( "Unable to delete resource at {}" , res . getIdentifier ( ) ) ; return serverError ( ) . entity ( "Unable to delete resource. Please consult the logs for more information" ) ; }
Delete the given resource
 @param res the resource
 @return a response builder
Delete the given resource @param res the resource @return a response builder
// Check if this is already deleted // Check the cache // Add the audit quads // When deleting just the ACL graph, keep the user managed triples in tact // delete the resource