public static Predicate < Quad > filterWithPrefer ( final Prefer prefer ) { final Set < String > include = new HashSet <> ( DEFAULT_REPRESENTATION ) ; ofNullable ( prefer ) . ifPresent ( p -> { p . getOmit ( ) . forEach ( include :: remove ) ; p . getInclude ( ) . forEach ( include :: add ) ; } ) ; return quad -> quad . getGraphName ( ) . filter ( x -> x instanceof IRI ) . map ( x -> ( IRI ) x ) . map ( IRI :: getIRIString ) . filter ( include :: contains ) . isPresent ( ) ; }
Create a filter based on a Prefer header