QueryResults extends Iterations { public static GraphQueryResult distinctResults(GraphQueryResult queryResult) { return new GraphQueryResultFilter(queryResult); }  static Model asModel(CloseableIteration<? extends Statement, ? extends RDF4JException> iteration); static Model asModel(CloseableIteration<? extends Statement, ? extends RDF4JException> iteration,
			ModelFactory modelFactory); static List<Value> getAllValues(TupleQueryResult result, String var); static Statement singleResult(GraphQueryResult result); static BindingSet singleResult(TupleQueryResult result); static GraphQueryResult distinctResults(GraphQueryResult queryResult); static TupleQueryResult distinctResults(TupleQueryResult queryResult); static TupleQueryResult limitResults(TupleQueryResult queryResult, long limit, long offset); static GraphQueryResult limitResults(GraphQueryResult queryResult, long limit, long offset); static GraphQueryResult parseGraphBackground(InputStream in, String baseURI, RDFFormat format); static GraphQueryResult parseGraphBackground(InputStream in, String baseURI, RDFParser parser); static void report(TupleQueryResult tqr, QueryResultHandler handler); static void report(GraphQueryResult gqr, RDFHandler rdfHandler); static boolean equals(TupleQueryResult tqr1, TupleQueryResult tqr2); static boolean isSubset(TupleQueryResult tqr1, TupleQueryResult tqr2); static boolean equals(GraphQueryResult result1, GraphQueryResult result2); static boolean bindingSetsCompatible(BindingSet bs1, BindingSet bs2);  }
@Test public void testDistinctGraphQueryResults() throws QueryEvaluationException { GraphQueryResult filtered = QueryResults.distinctResults(gqr); List<Statement> processed = new ArrayList<>(); while (filtered.hasNext()) { Statement result = filtered.next(); assertFalse(processed.contains(result)); processed.add(result); } }
@Test public void testDistinctTupleQueryResults() throws QueryEvaluationException { BindingSet a = new ListBindingSet(twoBindingNames, foo, lit1); BindingSet b = new ListBindingSet(twoBindingNames, bar, lit2); tqr1.append(a); tqr1.append(b); tqr1.append(a); tqr1.append(b); tqr1.append(b); TupleQueryResult filtered = QueryResults.distinctResults(tqr1); List<BindingSet> processed = new ArrayList<>(); while (filtered.hasNext()) { BindingSet result = filtered.next(); assertFalse(processed.contains(result)); processed.add(result); } }