// Return an iterator that converts the statements to var bindings
return new ConvertingIteration<Statement, BindingSet, QueryEvaluationException>(stIter) {
@Override
protected BindingSet convert(Statement st) {
QueryBindingSet result = new QueryBindingSet(bindings);
if (subjVar != null && !result.hasBinding(subjVar.getName())) {
result.addBinding(subjVar.getName(), st.getSubject());
}
if (predVar != null && !result.hasBinding(predVar.getName())) {
result.addBinding(predVar.getName(), st.getPredicate());
}
if (objVar != null && !result.hasBinding(objVar.getName())) {
result.addBinding(objVar.getName(), st.getObject());
}
if (conVar != null && !result.hasBinding(conVar.getName()) && st.getContext() != null) {
result.addBinding(conVar.getName(), st.getContext());
}
return result;
}
};