this.add(this.tripleConsumer, new KeyPredicatePattern(predPat), predPat);
return predPat;
}
// Normale TripleBearbeitung
// 1. TriplePattern erstellen
final TriplePattern pattern = (TriplePattern) zpattern;
// 2. Index erstellen, noch ohne succeding operator
final BasicOperator index = this.indexScanCreator.createIndexScanAndConnectWithRoot(null, new ArrayList<TriplePattern>(Arrays.asList(pattern)), null);
index.setPrecedingOperator(this.indexScanCreator.getRoot());
// 3. Pr�fen ob Triple-Pr�dikat an anderer Stelle erzeugt wird
final KeyTriplePattern keyPattern = new KeyTriplePattern(pattern);
boolean flag = false;
final HashSet<KeyTriplePattern> possibleMatchingKeysOfProducers = new LinkedHashSet<KeyTriplePattern>();
for(final KEY mainkey: this.tripleProducer.keySet()){
if(mainkey instanceof KeyTriplePattern){
final KeyTriplePattern mainkeyTP = (KeyTriplePattern) mainkey;
if(keyPattern.mayConsume(mainkeyTP)){
possibleMatchingKeysOfProducers.add(mainkeyTP);
flag = true;
}
}
}
if (flag) {
// index -> (union -> distinct) <- triplepattern : return union
// Distinct distinct = new Distinct();
final Union union = new Union();
// union.setSucceedingOperator(new OperatorIDTuple(distinct, 0));
index.setSucceedingOperator(new OperatorIDTuple(union, 0));
union.addPrecedingOperator(index);
// distinct.setSucceedingOperator((OperatorIDTuple) arg);
pattern.setSucceedingOperator(new OperatorIDTuple(union, 1));
union.addPrecedingOperator(pattern);
for(final KeyTriplePattern keyTP: possibleMatchingKeysOfProducers){
this.add(this.tripleConsumer, keyTP, pattern);
}
// return distinct;