use of fr.lirmm.graphik.graal.core.compilation.NoCompilation in project graal by graphik-team.
the class UnionConjunctiveQueriesSubstitutionIterator method hasNext.
@Override
public boolean hasNext() throws IteratorException {
if (!this.hasNextCallDone) {
this.hasNextCallDone = true;
if (this.tmpIt != null && !this.tmpIt.hasNext()) {
this.tmpIt.close();
this.tmpIt = null;
this.getProfiler().stop("SubQuery" + i++);
}
while ((this.tmpIt == null || !this.tmpIt.hasNext()) && this.cqueryIterator.hasNext()) {
ConjunctiveQuery q = this.cqueryIterator.next();
this.getProfiler().start("SubQuery" + i);
try {
if (this.homomorphism == null) {
this.tmpIt = SmartHomomorphism.instance().execute(q, this.atomSet, this.compilation);
} else {
if (this.compilation != null && !(this.compilation instanceof NoCompilation)) {
if (this.homomorphism instanceof HomomorphismWithCompilation) {
this.tmpIt = ((HomomorphismWithCompilation<ConjunctiveQuery, AtomSet>) this.homomorphism).execute(q, this.atomSet, this.compilation);
} else {
throw new IteratorException("There is a compilation and selected homomorphism can't handle it : " + this.homomorphism.getClass());
}
} else {
this.tmpIt = this.homomorphism.execute(q, this.atomSet);
}
}
if (this.isBooleanQuery && this.tmpIt.hasNext()) {
this.cqueryIterator.close();
}
} catch (HomomorphismException e) {
return false;
}
}
}
return this.tmpIt != null && this.tmpIt.hasNext();
}
Aggregations