this.equalityMap = HashMultimap.create();
this.usesEqualities = false;
// 1. Fakten muessen als erstes ausgewertet werden und dann in allen
// Operatorbaeumen beruecksichtigt werden.
this.predicateIndex = null;
InsertTripleIndexScan insertTripleIndex = null;
for (final IExpression fact : obj.getFacts()) {
if (fact instanceof Equality) {
final Equality eq = (Equality) fact;
this.equalityMap.put(eq.leftExpr, eq.rightExpr);
this.equalityMap.put(eq.rightExpr, eq.leftExpr);
this.usesEqualities = true;
} else {
final Object item = ((RulePredicate) fact).toDataStructure();
if (item instanceof Triple) {
insertTripleIndex = insertTripleIndex == null ? new InsertTripleIndexScan(this.indexScanCreator) : insertTripleIndex;
insertTripleIndex.addTripleFact((Triple) item);
} else if (item instanceof Predicate) {
this.predicateIndex = this.predicateIndex == null ? new PredicateIndexScan() : this.predicateIndex;
this.predicateIndex.addPredicateFact((Predicate) item);
}
}
}
if (insertTripleIndex != null){
this.indexScanCreator.getRoot().addSucceedingOperator(new OperatorIDTuple(insertTripleIndex, 0));
insertTripleIndex.addPrecedingOperator(this.indexScanCreator.getRoot());
}
if (this.predicateIndex != null){
this.indexScanCreator.getRoot().addSucceedingOperator(new OperatorIDTuple(this.predicateIndex, 1));
this.predicateIndex.addPrecedingOperator(this.indexScanCreator.getRoot());
}