@Override
public Tuple<Collection<BasicOperator>, Collection<BasicOperator>> transformOperatorGraph(
final Map<String, BasicOperator> mso,
final BasicOperator rootOperator) {
final Generate generate = (Generate) mso.get("generate");
// PatternMatcher has only TriplePattern as sons
final List<OperatorIDTuple> pats = rootOperator
.getSucceedingOperators();
final LinkedList<OperatorIDTuple> possiblePats = new LinkedList<OperatorIDTuple>();
// Find possible TriplePattern objects
TriplePattern pat;
for (int a = 0; a < pats.size(); a++) {
if (pats.get(a).getOperator() instanceof TriplePattern) {
pat = (TriplePattern) pats.get(a).getOperator();
if (matchPossible(generate.getValueOrVariable(),
pat.getItems(), doNotConnectInferenceRules)) {
possiblePats.add(new OperatorIDTuple(pat, 0));
pat.addPrecedingOperator(generate);
}
}
}
rootOperator.removePrecedingOperator(generate);
// Set new successors of Generate object
if (possiblePats.size() > 0) {
// System.out.println(generate.toString() + "----"
// + possiblePats.toString());
generate.setSucceedingOperators(possiblePats);
} else {
generate.setSucceedingOperators(new LinkedList<OperatorIDTuple>());
}
// rootOperator.deleteParents();
// rootOperator.setParents();
// rootOperator.detectCycles();