Package com.hp.hpl.jena.sparql.algebra

Examples of com.hp.hpl.jena.sparql.algebra.Op


            // Safely but inefficiently do nothing.
            return null ; //new Placement(input, exprs) ;
       
        if ( false ) {
         // Push into both sides.
            Op left = input.getLeft() ;
            Placement pLeft = transform(exprs, left) ;
           
            Op right = input.getRight() ;
            Placement pRight = transform(exprs, right) ;
           
            // JENA-652 Temporary fix
            if ( pLeft != null && ! pLeft.unplaced.isEmpty() )
                return noChangePlacement ;
            if ( pRight != null && ! pRight.unplaced.isEmpty() )
                return noChangePlacement ;

            // Old, buggy if not guarded by the above.
            left = transformOpAlways(exprs, left) ;
            right = transformOpAlways(exprs, right) ;
           
            Op op2 = OpUnion.create(left, right) ;
            return result(op2, emptyList) ;
        }
       
        Op left = input.getLeft() ;
        Placement pLeft = transform(exprs, left) ;
       
        Op right = input.getRight() ;
        Placement pRight = transform(exprs, right) ;
       
        // If it's placed in neitehr arm it should be passed back out for placement.
        //
        // If it's done in both arms, then expression can be left pushed in
        // and not passed back out for placement.
       
        // If it is done in one arm and not the other, then it can be left pushed
        // in but needs to be redone for the other arm as if it were no placed at all.
       
        // A filter applied twice is safe.
        // Placement = null => nothing done => unplaced.
       
        ExprList exprs2 = null ;
       
        for ( Expr expr : exprs ) {
            boolean unplacedLeft =  ( pLeft == null  || pLeft.unplaced.getList().contains(expr) ) ;
            boolean unplacedRight = ( pRight == null || pRight.unplaced.getList().contains(expr) ) ;
           
//            if ( unplacedLeft && unplacedRight ) {
//                System.out.println("Unplaced:     "+expr) ;
//            } else if ( unplacedLeft ) {
//                System.out.println("Unplaced(L):  "+expr) ;
//            } else if ( unplacedRight ) {
//                System.out.println("Unplaced(R):  "+expr) ;
//            } else
//                System.out.println("Placed(L+R):  "+expr) ;
           
            boolean placed = !unplacedLeft && !unplacedRight ;
            if ( placed )
                // Went into both arms - expression has been handled completely.
                continue ;
           
            if ( exprs2 == null )
                exprs2 = new ExprList() ;
            exprs2.add(expr) ;
        }
       
       
        Op newLeft = (pLeft == null ) ? left : pLeft.op ;
        Op newRight = (pRight == null ) ? right : pRight.op ;
        if ( exprs2 == null )
            exprs2 = emptyList ;
       
        Op op2 = OpUnion.create(newLeft, newRight) ;
        return result(op2, exprs2) ;
    }
View Full Code Here


            return resultNoChange(input) ;
       
        // (filter ... (extend ... ))
        //   ===>
        // (extend ... (filter ... ))
        Op opSub = input.getSubOp() ;
       
        // And try down the expressions
        Placement p = transform(pushed, opSub) ;

        if ( p == null ) {
            // Couldn't place an filter expressions.  Do nothing.
            return null ;
        }
       
        if ( ! p.unplaced.isEmpty() )
            // Some placed, not all.
            // Pass back out all untouched expressions.
            unpushed.addAll(p.unplaced) ;
        Op op1 = input.copy(p.op) ;
       
        return result(op1, unpushed) ;
    }
View Full Code Here

                unpushed.add(expr) ;
        }
        if ( pushed.isEmpty() )
            return resultNoChange(input) ;
        // (filter (project ...)) ===> (project (filter ...))
        Op opSub = input.getSubOp() ;
        Placement p = transform(pushed, opSub) ;
        if ( p == null ) {
            Op op1 = OpFilter.filter(pushed, opSub) ;
            Op op2 = input.copy(op1) ;
            return result(op2, unpushed) ;
        }
        Op op1 = OpFilter.filter(p.unplaced, p.op) ;
        Op op2 = input.copy(op1) ;
        return result(op2, unpushed) ;
    }
View Full Code Here

        return result(op2, unpushed) ;
    }
   
    private Placement placeTable(ExprList exprs, OpTable input) {
        exprs = ExprList.copy(exprs) ;
        Op op = insertAnyFilter$(exprs, input.getTable().getVars(), input) ;
        return result(op, exprs) ;
    }
View Full Code Here

    }

    @Override
    public Expr transform(ExprFunctionOp funcOp, ExprList args, Op opArg) {
        // Manually transform each argument
        Op op = Transformer.transform(new TransformCopy(), this, funcOp.getGraphPattern());
        ExprList newArgs = new ExprList();
        for (int i = 0; i < args.size(); i++) {
            Expr curr = args.get(i);
            Expr newArg = ExprTransformer.transform(this, curr) ;
            newArgs.add(newArg);
View Full Code Here

    }

    @Override
    public Expr copySubstitute(Binding binding)
    {
        Op op2 = Substitute.substitute(getGraphPattern(), binding) ;
        return new E_Exists(getElement(), op2) ;
    }
View Full Code Here

    }

    @Override
    public Expr applyNodeTransform(NodeTransform nodeTransform)
    {
        Op op2 = NodeTransformLib.transform(nodeTransform, getGraphPattern()) ;
        return new E_Exists(getElement(), op2) ;
    }
View Full Code Here

                }

                // Everything checks out so we can make the change
                if (ok) {
                    OpProject newProject = new OpProject(order.getSubOp(), project.getVars());
                    Op newReduced = OpReduced.create(newProject);
                    return new OpOrder(newReduced, order.getConditions());
                }
            }
        }
View Full Code Here

{
    /** Convert any paths of exactly one predicate to a triple pattern */
    public static Op pathToTriples(PathBlock pattern)
    {
        BasicPattern bp = null ;
        Op op = null ;

        for ( TriplePath tp : pattern )
        {
            if ( tp.isTriple() )
            {
View Full Code Here

        // algebra expression).
        // Any variables that reappear should be internal ones that were hidden
        // by renaming in the first place.
        // Any substitution is also safe because it replaced variables by
        // values.
        Op opRemote = Rename.reverseVarRename(op.getSubOp(), true);

        // JENA-494 There is a bug here that the renaming means that if this is
        // deeply nested and joined to other things at the same level of you end
        // up with the variables being disjoint and the same results
        // The naive fix for this is to map the variables visible in the inner
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.algebra.Op

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.