public static Op _replace(OpConditional op) { Op newLeft = replace(op.getLeft()); Op newRight = replace(op.getRight()); Op result = new OpConditional(newLeft, newRight); return result; }
@Override public Op2 copy(Op newLeft, Op newRight) { return new OpConditional(newLeft, newRight) ; }
@Override public void visit(OpConditional x) { x.getLeft().visit(this); }
/** * Rewrite left and right */ @Override public void visit(final OpConditional opCondition) { if (LOG.isDebugEnabled()) { LOG.debug("Starting visiting OpConditional"); } final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI); addOp(new OpConditional(rewriteOp2(opCondition, rewriter), rewriter.getResult())); }
return getRestrictions2(((OpLeftJoin) op).getLeft()); } else if(op instanceof OpConditional) { return getRestrictions2(((OpConditional)op).getLeft()); } else if(op instanceof OpDisjunction) { return null; // TODO We could factor out restrictions common to all elements
private static Op transformFilterConditional(ExprList exprs, Set<Var> varScope, OpConditional opConditional) { // Any filters that depend on no variables. Op op = insertAnyFilter(exprs, varScope, null); Op left = opConditional.getLeft(); left = transform(exprs, varScope, left); Op right = opConditional.getRight(); op = new OpConditional(left, right); op = insertAnyFilter(exprs, varScope, op); return op; }
@Override public Op make(ItemList list) { BuilderLib.checkLength(2, 3, list, "condition") ; Op left = build(list, 1) ; // No second argument means unit. Op right = OpTable.unit() ; if ( list.size() != 2 ) right = build(list, 2) ; Op op = new OpConditional(left, right) ; return op ; } } ;
private Placement placeConditional(ExprList exprs, OpConditional opConditional) { Op left = opConditional.getLeft() ; Op right = opConditional.getRight() ; Placement nLeft = transform(exprs, left) ; if ( isNoChange(nLeft) ) return result(opConditional, exprs) ; Op op = new OpConditional(nLeft.op, right) ; return result(op, nLeft.unplaced) ; }
@Override public Op transform(OpLeftJoin opLeftJoin, Op opLeft, Op opRight) { // Test whether we can do an indexed substitute into the right if possible. boolean canDoLinear = LeftJoinClassifier.isLinear(opLeftJoin) ; if ( canDoLinear ) { // Pass left into right for substitution before right side evaluation. // In an indexed left join, the LHS bindings are visible to the // RHS execution so the expression is evaluated by moving it to be // a filter over the RHS pattern. if (opLeftJoin.getExprs() != null ) opRight = OpFilter.filterBy(opLeftJoin.getExprs(), opRight) ; return new OpConditional(opLeft, opRight) ; } // Not index-able. return super.transform(opLeftJoin, opLeft, opRight) ; } }
@Override public void visit(OpConditional opCondition) { opCondition.getRight().visit(this); opCondition.getLeft().visit(this); push(new OpConditional(pop(), pop())); }
@Override public void visit(OpConditional opCondition) { opCondition.getRight().visit(this); opCondition.getLeft().visit(this); push(new OpConditional(pop(), pop())); }