use of org.eclipse.rdf4j.repository.sparql.query.SPARQLQueryBindingSet in project rdf4j by eclipse.
the class ServiceJoinConversionIteration method convert.
@Override
protected BindingSet convert(BindingSet bIn) throws QueryEvaluationException {
// overestimate the capacity
SPARQLQueryBindingSet res = new SPARQLQueryBindingSet(bIn.size() + bindings.size());
int bIndex = -1;
Iterator<Binding> bIter = bIn.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
String name = b.getName();
if (name.equals("__rowIdx")) {
bIndex = Integer.parseInt(b.getValue().stringValue());
continue;
}
res.addBinding(b.getName(), b.getValue());
}
// is dealt with in another place)
if (bIndex == -1)
throw new QueryEvaluationException("Invalid join. Probably this is due to non-standard behavior of the SPARQL endpoint. " + "Please report to the developers.");
res.addAll(bindings.get(bIndex));
return res;
}
use of org.eclipse.rdf4j.repository.sparql.query.SPARQLQueryBindingSet in project rdf4j by eclipse.
the class SPARQLCrossProductIteration method getNextElement.
@Override
protected BindingSet getNextElement() throws QueryEvaluationException {
if (currentInputBinding == null) {
inputBindingsIterator = inputBindings.iterator();
if (resultIteration.hasNext())
currentInputBinding = resultIteration.next();
else
// no more results
return null;
}
if (inputBindingsIterator.hasNext()) {
BindingSet next = inputBindingsIterator.next();
SPARQLQueryBindingSet res = new SPARQLQueryBindingSet(next.size() + currentInputBinding.size());
res.addAll(next);
res.addAll(currentInputBinding);
if (!inputBindingsIterator.hasNext())
currentInputBinding = null;
return res;
}
return null;
}
Aggregations