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

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


           
        if ( subOp instanceof OpOrder )
        {
            // First case: slice-order
            OpOrder opOrder = (OpOrder)subOp ;
            OpTopN opTopN = new OpTopN( opOrder.getSubOp(), (int)(offset+opSlice.getLength()), opOrder.getConditions() ) ;
            if ( offset == 0 ) {
                return opTopN ;
            } else {
                return new OpSlice( opTopN, offset, Query.NOLIMIT ) ;                 
            }
        }

        if ( subOp instanceof OpDistinct || subOp instanceof OpReduced )
        {
            // Second case: slice-distinct-order or slice-reduced-order
            Op subSubOp = ((Op1)subOp).getSubOp() ;
            if ( subSubOp instanceof OpOrder ) {
                OpOrder opOrder = (OpOrder)subSubOp ;
                Op opDistinct2 = OpDistinct.create(opOrder.getSubOp()) ;
                OpTopN opTopN = new OpTopN( opDistinct2, (int)(offset+opSlice.getLength()), opOrder.getConditions() ) ;
                if ( offset == 0 ) {
                    return opTopN ;
                } else {
                    return new OpSlice( opTopN, offset, Query.NOLIMIT ) ;                      
                }
            }
        }

        if ( subOp instanceof OpProject )
        {
            // 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


   * rewrites the subop of top.
   */
  @Override
  public void visit( final OpTopN opTop )
  {
    addOp(new OpTopN(rewriteOp1(opTop), opTop.getLimit(),
        opTop.getConditions()));
  }
View Full Code Here

           
        if ( subOp instanceof OpOrder )
        {
            // First case: slice-order
            OpOrder opOrder = (OpOrder)subOp ;
            OpTopN opTopN = new OpTopN( opOrder.getSubOp(), (int)(offset+opSlice.getLength()), opOrder.getConditions() ) ;
            if ( offset == 0 ) {
                return opTopN ;
            } else {
                return new OpSlice( opTopN, offset, Query.NOLIMIT ) ;                 
            }
        }

        if ( subOp instanceof OpDistinct || subOp instanceof OpReduced )
        {
            // Second case: slice-distinct-order or slice-reduced-order
            Op subSubOp = ((Op1)subOp).getSubOp() ;
            if ( subSubOp instanceof OpOrder ) {
                OpOrder opOrder = (OpOrder)subSubOp ;
                Op opDistinct2 = OpDistinct.create(opOrder.getSubOp()) ;
                OpTopN opTopN = new OpTopN( opDistinct2, (int)(offset+opSlice.getLength()), opOrder.getConditions() ) ;
                if ( offset == 0 ) {
                    return opTopN ;
                } else {
                    return new OpSlice( opTopN, offset, Query.NOLIMIT ) ;                      
                }
            }
        }

        if ( subOp instanceof OpProject )
        {
            // 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

TOP

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

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.