@Override protected void meetUnaryTupleOperator(UnaryTupleOperator node) throws RepositoryException { super.meetUnaryTupleOperator(node); RepositoryConnection owner = getSingleOwner(node.getArg()); if (owner != null) { node.replaceWith(new OwnedTupleExpr(owner, node.clone())); } }
@Override public boolean equals(Object other) { return other instanceof Distinct && super.equals(other); }
@Override protected void meetUnaryTupleOperator(UnaryTupleOperator node) { super.meetUnaryTupleOperator(node); if (node.getArg() instanceof EmptySet) { node.replaceWith(node.getArg()); } }
@Override public boolean equals(Object other) { if (other instanceof UnaryTupleOperator) { UnaryTupleOperator o = (UnaryTupleOperator)other; return arg.equals(o.getArg()); } return false; }
@Override public void meet(Reduced node) throws RuntimeException { TupleExpr child = node.getArg(); if(!isSupported(child) && child instanceof UnaryTupleOperator) { UnaryTupleOperator replacement = (UnaryTupleOperator)child.clone(); // switch positions of child and node node.replaceWith(replacement); node.setArg(((UnaryTupleOperator) child).getArg().clone()); replacement.setArg(node.clone()); // visit the newly inserted replacement node (i.e. the clone of child now containing the old "node" as // child, so "node" can be bubbled down further if needed) replacement.visit(this); } }
@Override public void meetOther(QueryModelNode node) { if (node instanceof PeriodicQueryNode) { PeriodicQueryNode pNode = (PeriodicQueryNode) node; // do nothing if PeriodicQueryNode already positioned correctly if (pNode.equals(relocationParent.getArg())) { return; } // remove node from query pNode.replaceWith(pNode.getArg()); // set node' child to be relocationParent's child pNode.setArg(relocationParent.getArg()); // add node back into query below relocationParent relocationParent.replaceChildNode(relocationParent.getArg(), pNode); } } }
@Override public Slice clone() { return (Slice)super.clone(); } }
/** * Creates a new unary tuple operator. * * @param arg * The operator's argument, must not be <tt>null</tt>. */ public UnaryTupleOperator(TupleExpr arg) { setArg(arg); }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (replaceNodeInList(groupElements, current, replacement)) { return; } super.replaceChildNode(current, replacement); }
@Override protected void meetUnaryTupleOperator(UnaryTupleOperator node) { node.getArg().visit(this); }
@Override public void meet(Slice node) throws RuntimeException { TupleExpr child = node.getArg(); if(!isSupported(child) && child instanceof UnaryTupleOperator) { UnaryTupleOperator replacement = (UnaryTupleOperator)child.clone(); // switch positions of child and node node.replaceWith(replacement); node.setArg(((UnaryTupleOperator) child).getArg().clone()); replacement.setArg(node.clone()); // visit the newly inserted replacement node (i.e. the clone of child now containing the old "node" as // child, so "node" can be bubbled down further if needed) replacement.visit(this); } }
@Override public QueryRoot clone() { return (QueryRoot)super.clone(); } }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (arg == current) { setArg((TupleExpr)replacement); } else { super.replaceChildNode(current, replacement); } }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (serviceRef == current) { setServiceRef((Var)replacement); } else { super.replaceChildNode(current, replacement); } }
public Set<String> getBindingNames() { return getArg().getBindingNames(); }
@Override public void meet(Distinct node) throws RuntimeException { TupleExpr child = node.getArg(); if(!isSupported(child) && child instanceof UnaryTupleOperator) { UnaryTupleOperator replacement = (UnaryTupleOperator)child.clone(); // switch positions of child and node node.replaceWith(replacement); node.setArg(((UnaryTupleOperator) child).getArg().clone()); replacement.setArg(node.clone()); // visit the newly inserted replacement node (i.e. the clone of child now containing the old "node" as // child, so "node" can be bubbled down further if needed) replacement.visit(this); } }
@Override protected void meetUnaryTupleOperator(UnaryTupleOperator node) throws RepositoryException { super.meetUnaryTupleOperator(node); RepositoryConnection owner = getSingleOwner(node.getArg()); if (owner != null) { node.replaceWith(new OwnedTupleExpr(owner, node.clone())); } }
@Override public Reduced clone() { return (Reduced)super.clone(); } }