@Test void testFilterPrefer3() { final Set<IRI> filtered3 = HttpUtils.triplePreferences(Prefer.valueOf("return=representation; include=\"" + Trellis.PreferAudit.getIRIString() + "\"")); assertTrue(filtered3.contains(Trellis.PreferAudit), "Prefer filter omits audit quad!"); assertTrue(filtered3.contains(Trellis.PreferServerManaged), "Prefe filter omits server managed quad!"); assertTrue(filtered3.contains(Trellis.PreferUserManaged), "Prefer filter omits user managed quad!"); assertEquals(5, filtered3.size(), "Incorrect size of filtered quad list!"); }
public static Set<IRI> triplePreferences(final Prefer prefer) { final Set<IRI> include = new HashSet<>(DEFAULT_REPRESENTATION); if (prefer != null) { if (prefer.getInclude().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(LDP.PreferContainment); include.remove(LDP.PreferMembership); } if (prefer.getOmit().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(Trellis.PreferUserManaged); include.remove(Trellis.PreferServerManaged); } prefer.getOmit().stream().map(rdf::createIRI).forEach(include::remove); prefer.getInclude().stream().map(rdf::createIRI) .filter(iri -> !ignoredPreferences.contains(iri)).forEach(include::add); } return include; }
HttpUtils { public static Set<IRI> triplePreferences(final Prefer prefer) { final Set<IRI> include = new HashSet<>(DEFAULT_REPRESENTATION); if (prefer != null) { if (prefer.getInclude().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(LDP.PreferContainment); include.remove(LDP.PreferMembership); } if (prefer.getOmit().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(Trellis.PreferUserManaged); include.remove(Trellis.PreferServerManaged); } prefer.getOmit().stream().map(rdf::createIRI).forEach(include::remove); prefer.getInclude().stream().map(rdf::createIRI) .filter(iri -> !ignoredPreferences.contains(iri)).forEach(include::add); } return include; } }
HttpUtils { public static Set<IRI> triplePreferences(final Prefer prefer) { final Set<IRI> include = new HashSet<>(DEFAULT_REPRESENTATION); if (prefer != null) { if (prefer.getInclude().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(LDP.PreferContainment); include.remove(LDP.PreferMembership); } if (prefer.getOmit().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(Trellis.PreferUserManaged); include.remove(Trellis.PreferServerManaged); } prefer.getOmit().stream().map(rdf::createIRI).forEach(include::remove); prefer.getInclude().stream().map(rdf::createIRI) .filter(iri -> !ignoredPreferences.contains(iri)).forEach(include::add); } return include; } private  HttpUtils(); }
HttpUtils { public static Set<IRI> triplePreferences(final Prefer prefer) { final Set<IRI> include = new HashSet<>(DEFAULT_REPRESENTATION); if (prefer != null) { if (prefer.getInclude().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(LDP.PreferContainment); include.remove(LDP.PreferMembership); } if (prefer.getOmit().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(Trellis.PreferUserManaged); include.remove(Trellis.PreferServerManaged); } prefer.getOmit().stream().map(rdf::createIRI).forEach(include::remove); prefer.getInclude().stream().map(rdf::createIRI) .filter(iri -> !ignoredPreferences.contains(iri)).forEach(include::add); } return include; } private  HttpUtils(); static Stream<IRI> ldpResourceTypes(final IRI ixnModel); static boolean matchIdentifier(final BlankNodeOrIRI subject, final IRI identifier); static Set<IRI> triplePreferences(final Prefer prefer); static Function<Triple, Triple> unskolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Triple, Triple> skolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl); static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes,
            final String mimeType); static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax); static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier,
            final String defaultJsonLdProfile); static IRI getDefaultProfile(final RDFSyntax syntax, final IRI identifier,
            final String defaultJsonLdProfile); static boolean isContainer(final IRI ldpType); static void checkIfModifiedSince(final String method, final String ifModifiedSince,
            final Instant modified); static void checkIfUnmodifiedSince(final String ifUnmodifiedSince, final Instant modified); static void checkIfMatch(final String ifMatch, final EntityTag etag); static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag); static void checkRequiredPreconditions(final boolean required, final String ifMatch,
            final String ifUnmodifiedSince); static boolean exists(final Resource resource); static void closeDataset(final Dataset dataset); static String buildResourceUrl(final TrellisRequest req, final String baseUrl); }
HttpUtils { public static Set<IRI> triplePreferences(final Prefer prefer) { final Set<IRI> include = new HashSet<>(DEFAULT_REPRESENTATION); if (prefer != null) { if (prefer.getInclude().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(LDP.PreferContainment); include.remove(LDP.PreferMembership); } if (prefer.getOmit().contains(LDP.PreferMinimalContainer.getIRIString())) { include.remove(Trellis.PreferUserManaged); include.remove(Trellis.PreferServerManaged); } prefer.getOmit().stream().map(rdf::createIRI).forEach(include::remove); prefer.getInclude().stream().map(rdf::createIRI) .filter(iri -> !ignoredPreferences.contains(iri)).forEach(include::add); } return include; } private  HttpUtils(); static Stream<IRI> ldpResourceTypes(final IRI ixnModel); static boolean matchIdentifier(final BlankNodeOrIRI subject, final IRI identifier); static Set<IRI> triplePreferences(final Prefer prefer); static Function<Triple, Triple> unskolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Triple, Triple> skolemizeTriples(final ResourceService svc, final String baseUrl); static Function<Quad, Quad> skolemizeQuads(final ResourceService svc, final String baseUrl); static RDFSyntax getSyntax(final IOService ioService, final List<MediaType> acceptableTypes,
            final String mimeType); static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax); static IRI getDefaultProfile(final RDFSyntax syntax, final String identifier,
            final String defaultJsonLdProfile); static IRI getDefaultProfile(final RDFSyntax syntax, final IRI identifier,
            final String defaultJsonLdProfile); static boolean isContainer(final IRI ldpType); static void checkIfModifiedSince(final String method, final String ifModifiedSince,
            final Instant modified); static void checkIfUnmodifiedSince(final String ifUnmodifiedSince, final Instant modified); static void checkIfMatch(final String ifMatch, final EntityTag etag); static void checkIfNoneMatch(final String method, final String ifNoneMatch, final EntityTag etag); static void checkRequiredPreconditions(final boolean required, final String ifMatch,
            final String ifUnmodifiedSince); static boolean exists(final Resource resource); static void closeDataset(final Dataset dataset); static String buildResourceUrl(final TrellisRequest req, final String baseUrl);  }