/** Create join, removing any joins with the identity table and any nulls. * <br>Join.create(null, op) is op. * <br>Join.create(op, null) is op. * <br>Join.create(TableUnit, op) is op. * <br>Join.create(op, TableUnit) is op. */ public static Op createReduce(Op left, Op right) { if ( left == null || isJoinIdentify(left) ) return right ; if ( right == null || isJoinIdentify(right) ) return left ; return new OpJoin(left, right) ; }
private static Op join(Op left, Op right) { return OpJoin.createReduce(left, right) ; } }
protected static Op join(Op current, Op newOp) { if ( simplifyTooEarlyInAlgebraGeneration && applySimplification ) return OpJoin.createReduce(current, newOp) ; return OpJoin.create(current, newOp) ; }
/** Create join - an argument of null is * simply dropped so Join.create(null, op) is op and Join.create(op,null) is op. */ public static Op create(Op left, Op right) { if ( left == null ) return right ; if ( right == null ) return left ; return new OpJoin(left, right) ; }
public Op getApplicableViews(OpJoin op, RestrictionManagerImpl restrictions) { // TODO Restrictions from the left hand side should carry over to the right hand side // Even better, if constraints on both sides were equally respected Op result = processJoinSplitLhs(op.getLeft(), op.getRight(), null, restrictions, false); return result; //return OpJoin.create(_getApplicableViews(op.getLeft(), restrictions), _getApplicableViews(op.getRight(), restrictions)); }
private static Op join(Op op1, Op op2) { return OpJoin.create(op1, op2) ; }
@Override public Op2 copy(Op newLeft, Op newRight) { return new OpJoin(newLeft, newRight) ; }
/** * Parses the joins and recursively calls the left and right parts */ @Override public void visit(final OpJoin opJoin) { if (LOG.isDebugEnabled()) { LOG.debug("Starting visiting OpJoin"); } final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI); addOp(OpJoin.create(rewriteOp2(opJoin, rewriter), rewriter.getResult())); }
public static Op _optimize(OpJoin op, Set<Set<Expr>> cnf) { Set<Set<Expr>> leftCnf = filterByVars(cnf, op.getLeft()); Set<Set<Expr>> rightCnf = filterByVars(cnf, op.getLeft()); Set<Set<Expr>> union = Sets.union(leftCnf, rightCnf); Set<Set<Expr>> remaining = Sets.difference(cnf, union); Op result = OpJoin.create(optimize(op.getLeft(), leftCnf), optimize(op.getRight(), rightCnf)); if(!remaining.isEmpty()) { result = OpFilter.filter(cnfToExprList(remaining), result); } return result; }
@Override public Op make(ItemList list) { BuilderLib.checkLength(3, list, "Join") ; Op left = build(list, 1) ; Op right = build(list, 2) ; Op op = OpJoin.create(left, right) ; return op ; } } ;