use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class QueryResultsTest method testNonBNodeBindingSet1.
@Test
public void testNonBNodeBindingSet1() throws QueryEvaluationException {
tqr1.append(new ListBindingSet(twoBindingNames, foo, lit1));
tqr1.append(new ListBindingSet(twoBindingNames, bar, lit2));
tqr2.append(new ListBindingSet(twoBindingNames, bar, lit2));
tqr2.append(new ListBindingSet(twoBindingNames, foo, lit1));
assertTrue(QueryResults.equals(tqr1, tqr2));
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class QueryResultsTest method testBNodeBindingSet7.
@Test
public void testBNodeBindingSet7() throws QueryEvaluationException {
tqr3.append(new ListBindingSet(threeBindingNames, foo, bnode2, bnode1));
tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2));
assertFalse(QueryResults.equals(tqr1, tqr3));
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class QueryResultsTest method testDistinctTupleQueryResults.
@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<BindingSet>();
while (filtered.hasNext()) {
BindingSet result = filtered.next();
assertFalse(processed.contains(result));
processed.add(result);
}
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class QueryResultsTest method testBNodeBindingSet4.
@Test
public void testBNodeBindingSet4() throws QueryEvaluationException {
tqr1.append(new ListBindingSet(twoBindingNames, bnode1, bnode2));
tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2));
tqr2.append(new ListBindingSet(twoBindingNames, bnode2, bnode1));
tqr2.append(new ListBindingSet(twoBindingNames, foo, bnode1));
assertTrue(QueryResults.equals(tqr1, tqr2));
}
use of org.eclipse.rdf4j.query.impl.ListBindingSet in project rdf4j by eclipse.
the class BinaryQueryResultWriter method startQueryResult.
@Override
public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException {
tupleVariablesFound = true;
if (!documentStarted) {
startDocument();
}
// Copy supplied column headers list and make it unmodifiable
bindingNames = new ArrayList<String>(bindingNames);
this.bindingNames = Collections.unmodifiableList(bindingNames);
try {
out.writeInt(this.bindingNames.size());
for (String bindingName : this.bindingNames) {
writeString(bindingName);
}
List<Value> nullTuple = Collections.nCopies(this.bindingNames.size(), (Value) null);
previousBindings = new ListBindingSet(this.bindingNames, nullTuple);
nextNamespaceID = 0;
} catch (IOException e) {
throw new TupleQueryResultHandlerException(e);
}
}
Aggregations