use of com.bigdata.rdf.sparql.ast.IBindingProducerNode in project wikidata-query-rdf by wikimedia.
the class WikidataServicePlacementOptimizer method findLatestPossiblePositionForTheServiceNode.
private int findLatestPossiblePositionForTheServiceNode(StaticAnalysis sa, BOp serviceNode, final JoinGroupNode joinGroup) {
int lastJoinIndex = -1;
// Retrieve inVars from annotations. If no WIKIDATA_SERVICE_IN_VARS annotation provided
// (which occurs on first run of LabelServicePlacementOptimizer), we still need to
// traverse the tree, as there might be NamedSubqueryInclude, which might
// be producing variables for ServiceNode.
Object inVarsObject = serviceNode.annotations().get(WIKIDATA_SERVICE_IN_VARS);
@SuppressWarnings("unchecked") Set<IVariable<?>> inVars = inVarsObject instanceof Set ? (Set<IVariable<?>>) inVarsObject : Collections.emptySet();
for (int i = joinGroup.size() - 1; i >= 0; i--) {
BOp child = joinGroup.get(i);
if (child != serviceNode && child instanceof IBindingProducerNode) {
// will touch any inbound var for the service
if (checkIfNodeProducesVars(sa, child, inVars)) {
lastJoinIndex = i;
break;
}
}
}
return lastJoinIndex;
}
Aggregations