code: 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;
      }
docs: Filter the triples
  @param triples Iterator of triples
  @param properties Properties to include
  @return Graph containing the fitlered triples