private static boolean matchBindingSets(List<? extends BindingSet> queryResult1, Iterable<? extends BindingSet> queryResult2) { return matchBindingSets(queryResult1, queryResult2, new HashMap<BNode, BNode>(), 0); }
public static boolean isSubset(TupleQueryResult tqr1, TupleQueryResult tqr2) throws QueryEvaluationException { List<BindingSet> list1 = Iterations.asList(tqr1); List<BindingSet> list2 = Iterations.asList(tqr2); // Compare the number of statements in both sets if (list1.size() > list2.size()) { return false; } return matchBindingSets(list1, list2); }
/** * Compares two tuple query results and returns {@code true} if they are * equal. Tuple query results are equal if they contain the same set of * {@link BindingSet}s and have the same headers. Blank nodes identifiers are * not relevant for equality, they are matched by trying to find compatible * mappings between BindingSets. Note that the method consumes both query * results fully. * * @param tqr1 * the first {@link TupleQueryResult} to compare. * @param tqr2 * the second {@link TupleQueryResult} to compare. * @throws QueryEvaluationException */ public static boolean equals(TupleQueryResult tqr1, TupleQueryResult tqr2) throws QueryEvaluationException { List<BindingSet> list1 = Iterations.asList(tqr1); List<BindingSet> list2 = Iterations.asList(tqr2); // Compare the number of statements in both sets if (list1.size() != list2.size()) { return false; } return matchBindingSets(list1, list2); }
result = matchBindingSets(queryResult1, queryResult2, newBNodeMapping, idx + 1);