@Override public void meet(Var var) { if (toBeReplaced.equals(var) || (toBeReplaced.isAnonymous() && var.isAnonymous() && (toBeReplaced.hasValue() && toBeReplaced.getValue().equals(var.getValue())))) { QueryModelNode parent = var.getParentNode(); parent.replaceChildNode(var, replacement); replacement.setParentNode(parent); } else if (replaceAnons && var.isAnonymous() && !var.hasValue()) { Var replacementVar = createAnonVar("anon-replace-" + var.getName() + index); QueryModelNode parent = var.getParentNode(); parent.replaceChildNode(var, replacementVar); replacementVar.setParentNode(parent); } }