use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterDefaulting method moveToNextBinding.
@Override
protected Binding moveToNextBinding() {
if (isFinished())
throw new NoSuchElementException(Lib.className(this));
if (returnDefaultObject) {
haveReturnedSomeObject = true;
return defaultObject;
}
Binding binding = null;
if (iter != null && iter.hasNext())
binding = iter.next();
else {
if (haveReturnedSomeObject)
throw new NoSuchElementException("DefaultingIterator - without hasNext call first");
binding = defaultObject;
}
haveReturnedSomeObject = true;
return binding;
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterDistinct method hasNextBinding.
@Override
protected boolean hasNextBinding() {
if (slot != null)
return true;
if (iterator != null)
// Databag active.
return iterator.hasNext();
// At this point, we are currently in the initial pre-threshold mode.
if (seen.size() < memThreshold) {
Binding b = getInputNextUnseen();
if (b == null)
return false;
seen.add(b);
slot = b;
return true;
}
// Hit the threshold.
loadDataBag();
// Switch to iterating from the data bag.
iterator = db.iterator();
// Leave slot null.
return iterator.hasNext();
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterDistinct method moveToNextBinding.
@Override
protected Binding moveToNextBinding() {
if (slot != null) {
Binding b = slot;
slot = null;
return b;
}
if (iterator != null) {
Binding b = iterator.next();
return b;
}
throw new InternalErrorException();
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterDistinctReduced method hasNextBinding.
@Override
protected final boolean hasNextBinding() {
// Already waiting to go.
if (slot != null)
return true;
// Always moves.
for (; getInput().hasNext(); ) {
Binding b = getInput().nextBinding();
// Hide unnamed and internal variables.
// Don't need to worry about rename scope vars
// (they are projected away in sub-SELECT ?var { ... })
b = new BindingProjectNamed(b);
if (isFreshSighting(b)) {
slot = b;
return true;
}
}
return false;
}
use of org.apache.jena.sparql.engine.binding.Binding in project jena by apache.
the class QueryIterDistinctReduced method moveToNextBinding.
@Override
protected final Binding moveToNextBinding() {
Binding r = slot;
slot = null;
return r;
}
Aggregations