Search in sources :

Example 1 with NoCompilation

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();
}
Also used : IteratorException(fr.lirmm.graphik.util.stream.IteratorException) NoCompilation(fr.lirmm.graphik.graal.core.compilation.NoCompilation) HomomorphismException(fr.lirmm.graphik.graal.api.homomorphism.HomomorphismException) AtomSet(fr.lirmm.graphik.graal.api.core.AtomSet) ConjunctiveQuery(fr.lirmm.graphik.graal.api.core.ConjunctiveQuery) HomomorphismWithCompilation(fr.lirmm.graphik.graal.api.homomorphism.HomomorphismWithCompilation)

Aggregations

AtomSet (fr.lirmm.graphik.graal.api.core.AtomSet)1 ConjunctiveQuery (fr.lirmm.graphik.graal.api.core.ConjunctiveQuery)1 HomomorphismException (fr.lirmm.graphik.graal.api.homomorphism.HomomorphismException)1 HomomorphismWithCompilation (fr.lirmm.graphik.graal.api.homomorphism.HomomorphismWithCompilation)1 NoCompilation (fr.lirmm.graphik.graal.core.compilation.NoCompilation)1 IteratorException (fr.lirmm.graphik.util.stream.IteratorException)1