public static Graph filterTriples ( final Iterator < Triple > triples , final Node ... properties ) { final Graph filteredGraph = new RandomOrderGraph ( RandomOrderGraph . createDefaultGraph ( ) ) ; final Sink < Triple > graphOutput = new SinkTriplesToGraph ( true , filteredGraph ) ; final RDFSinkFilter rdfFilter = new RDFSinkFilter ( graphOutput , properties ) ; rdfFilter . start ( ) ; while ( triples . hasNext ( ) ) { final Triple triple = triples . next ( ) ; rdfFilter . triple ( triple ) ; } rdfFilter . finish ( ) ; return filteredGraph ; }
Filter the triples