use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterDistinct method getInputNext.
/** Return the binding from the input, hiding any variables to be ignored. */
private Binding getInputNext() {
Binding b = getInput().next();
// Hide unnamed and internal variables.
b = new BindingProjectNamed(b);
return b;
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterDistinct method loadDataBag.
/** Load the data bag with. Filter incoming by the already seen in-memory elements */
private void loadDataBag() {
ThresholdPolicy<Binding> policy = ThresholdPolicyFactory.policyFromContext(super.getExecContext().getContext());
Comparator<Binding> comparator = new BindingComparator(new ArrayList<SortCondition>(), super.getExecContext());
this.db = BagFactory.newDistinctBag(policy, SerializationFactoryFinder.bindingSerializationFactory(), comparator);
for (; ; ) {
Binding b = getInputNextUnseen();
if (b == null)
break;
db.add(b);
}
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterMinus method moveToNextBinding.
@Override
protected final Binding moveToNextBinding() {
if (!hasNextBinding())
return null;
Binding x = slot;
slot = null;
return x;
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterPeek method moveToNextBinding.
@Override
protected Binding moveToNextBinding() {
if (!hasNextBinding())
throw new ARQInternalErrorException("No next binding");
Binding b = binding;
binding = null;
return b;
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class TestCancelDistinct method testBaggedCancelPropagates.
/**
test that of a QueryIterDistinct with an active databag is
cancelled, so is the iterator that it wraps.
*/
@Test
public void testBaggedCancelPropagates() {
params.set(ARQ.spillToDiskThreshold, 0);
QueryIteratorBase base = new MockQueryIterator(BindingFactory.create());
QueryIterDistinct d = new QueryIterDistinct(base, c);
assertNull(d.db);
Binding b = d.next();
assertNotNull(d.db);
DistinctDataBag<Binding> db = d.db;
assertFalse(base.getRequestingCancel());
d.cancel();
assertTrue(base.getRequestingCancel());
}
Aggregations