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

Examples of com.hp.hpl.jena.sparql.algebra.op.OpProject


   * rewrites the subop of project.
   */
  @Override
  public void visit( final OpProject opProject )
  {
    addOp(new OpProject(rewriteOp1(opProject), opProject.getVars()));
  }
View Full Code Here


    // Best is this is after TransformTopN but they are order independent
    // TopN of "reduced or distinct of order" is handled.
    //@Override
    public Op transform1(OpDistinct opDistinct, Op subOp) {
        if (subOp instanceof OpProject) {
            OpProject opProject = (OpProject) subOp;
            if (opProject.getSubOp() instanceof OpOrder) {
                OpOrder opOrder = (OpOrder) opProject.getSubOp();
                Set<Var> projectVars = new HashSet<>(opProject.getVars()) ;
                if (isSafe(projectVars, opOrder)) {
                    return OpReduced.create(subOp);
                }
            }
        }
View Full Code Here

         */
        if (subOp instanceof OpOrder) {
            opOrder = (OpOrder) subOp;
            projectVars = OpVars.visibleVars(subOp) ;
        } else if (subOp instanceof OpProject) {
            OpProject opProject = (OpProject) subOp;
            if (opProject.getSubOp() instanceof OpOrder) {
                projectVars = new HashSet<>(opProject.getVars()) ;
                opOrder = (OpOrder) opProject.getSubOp();
            }
        }

        if ( projectVars == null )
            return super.transform(opDistinct, subOp) ;
View Full Code Here

            // Put back project - as an OpProject to leave for the bridge.
            OpSQL x = new OpSQL(n, opProject, request) ;
            x.setBridge(opSQL.getBridge()) ;
            // Bridge will be set later.
            // Is OpProject needed?
            return new OpProject(x, pv) ;
        }
View Full Code Here

    public Op transform(OpSlice opSlice, Op subOp)
    {
        // (slice (project...)) ==> (project (slice ...))
        if ( subOp instanceof OpProject )
        {
            OpProject p = (OpProject)subOp ;
            Op sub = p.getSubOp() ;
           
            Op x = new OpSlice(sub, opSlice.getStart(), opSlice.getLength()) ;
            x = new OpProject(x, p.getVars()) ;
            return x ;
        }
       
        return super.transform(opSlice, subOp) ;
    }
View Full Code Here

        {
            // Third case: slice-project-order
            Op subSubOp = ((Op1)subOp).getSubOp() ;
            if ( subSubOp instanceof OpOrder )
            {
                OpProject opProject = (OpProject)subOp ;
                OpOrder opOrder = (OpOrder)subSubOp ;
                // NB leave project over topN, unlike the distinct case where distinct goes under topN.
                OpTopN opTopN = new OpTopN( opOrder.getSubOp(), (int)(offset+opSlice.getLength()), opOrder.getConditions() ) ;
                Op proj = new OpProject(opTopN, opProject.getVars()) ;
                if ( offset == 0 ) {
                    return proj ;
                } else {
                    return new OpSlice( proj, offset, Query.NOLIMIT ) ;                      
                }
View Full Code Here

    {
        List<Var> x = opProject.getVars() ;
        List<Var> x2 = NodeTransformLib.transformVars(transform, x) ;
        if ( x == x2 )
            return super.transform(opProject, subOp) ;
        return new OpProject(subOp, x2) ;
    }
View Full Code Here

    // Best is this is after TransformTopN but they are order independent
    // TopN of "reduced or distinct of order" is handled.
    //@Override
    public Op transform1(OpDistinct opDistinct, Op subOp) {
        if (subOp instanceof OpProject) {
            OpProject opProject = (OpProject) subOp;
            if (opProject.getSubOp() instanceof OpOrder) {
                OpOrder opOrder = (OpOrder) opProject.getSubOp();
                Set<Var> projectVars = new HashSet<Var>(opProject.getVars()) ;
                if (isSafe(projectVars, opOrder)) {
                    return OpReduced.create(subOp);
                }
            }
        }
View Full Code Here

         */
        if (subOp instanceof OpOrder) {
            opOrder = (OpOrder) subOp;
            projectVars = OpVars.visibleVars(subOp) ;
        } else if (subOp instanceof OpProject) {
            OpProject opProject = (OpProject) subOp;
            if (opProject.getSubOp() instanceof OpOrder) {
                projectVars = new HashSet<Var>(opProject.getVars()) ;
                opOrder = (OpOrder) opProject.getSubOp();
            }
        }

        if ( projectVars == null )
            return super.transform(opDistinct, subOp) ;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.algebra.op.OpProject

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.