use of fr.lirmm.graphik.graal.homomorphism.scheduler.PatternScheduler in project graal by graphik-team.
the class BacktrackIteratorData method preprocessing.
private void preprocessing(Set<Variable> variablesToParameterize, Profiler profiler) throws HomomorphismException {
profiler.start("preprocessingTime");
// Compute order on query variables and atoms
if (variablesToParameterize != null && !variablesToParameterize.isEmpty()) {
assert this.scheduler instanceof PatternScheduler;
PatternScheduler sched = (PatternScheduler) this.scheduler;
this.varsOrder = sched.execute(this.query, variablesToParameterize, ans, this.data, this.compilation);
} else {
this.varsOrder = this.scheduler.execute(this.query, ans, this.data, this.compilation);
}
this.levelMax = varsOrder.length - 2;
// PROFILING
if (profiler.isProfilingEnabled()) {
this.profilingVarOrder(this.varsOrder, profiler);
}
// Index Var structures by original variable object
this.index = new TreeMap<Variable, Integer>();
for (VarSharedData v : this.varsOrder) {
if (v.value != null) {
//
this.index.put(v.value, v.level);
}
}
if (this.ans.isEmpty()) {
this.varsOrder[this.levelMax + 1].previousLevel = -1;
}
computeAtomOrder(this.query, this.varsOrder, this.index);
this.fc.init(this.varsOrder, this.index);
this.bj.init(this.varsOrder);
Set<Variable> allVarsFromH = query.getVariables();
for (InMemoryAtomSet negPart : this.negParts) {
Set<Variable> frontier = SetUtils.intersection(allVarsFromH, negPart.getVariables());
this.varsOrder[maxLevel(frontier)].negatedPartsToCheck.add(BacktrackHomomorphismPattern.instance().prepareHomomorphism(new DefaultConjunctiveQuery(negPart, Collections.<Term>emptyList()), frontier, this.data, this.compilation));
}
profiler.stop("preprocessingTime");
}
Aggregations