@Override
public BasicOperator visit(final ASTNegatedPath node,
final OperatorConnection connection, final Item graphConstraint,
final Variable subject, final Variable object, final Node subjectNode, final Node objectNode) {
final Minus minus = new Minus();
final Union union = new Union();
final Item[] items = {subject, this.getVariable(subject.toString(), object.toString(), "b"), object};
final TriplePattern tp = new TriplePattern(items);
final LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
temp.add(tp);
this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(minus,0), temp, graphConstraint);
for (int i = 0; i < node.jjtGetNumChildren(); i++){
final Item[] items2 = new Item[3];
if(node.jjtGetChild(i) instanceof ASTInvers){
items2[0] = object;
items2[1] = getItem(node.jjtGetChild(i).jjtGetChild(0));
items2[2] = subject;
} else {
items2[0] = subject;
items2[1] = getItem(node.jjtGetChild(i));
items2[2] = object;
}
final TriplePattern tp2 = new TriplePattern(items2);
final LinkedList<TriplePattern> temp2 = new LinkedList<TriplePattern>();
temp2.add(tp2);
this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(union,i), temp2, graphConstraint);
}
union.addSucceedingOperator(new OperatorIDTuple(minus,1));
final Projection projection = new Projection();
projection.addProjectionElement(subject);
projection.addProjectionElement(object);
if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
projection.addProjectionElement((Variable)graphConstraint);
}
minus.addSucceedingOperator(new OperatorIDTuple(projection,0));
return projection;
}