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

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


            return (OpQuadPattern)op ;
       
        if ( op instanceof OpSequence )
        {
            // Is last in OpSequence an BGP?
            OpSequence opSeq = (OpSequence)op ;
            List<Op> x = opSeq.getElements() ;
            if ( x.size() > 0 )
            {               
                Op opTop = x.get(x.size()-1) ;
                if ( opTop instanceof OpQuadPattern )
                    return (OpQuadPattern)opTop ;
View Full Code Here


            // Simple rewrite.
            Node n = graphs.iterator().next() ;
            return new OpQuadPattern(n, basicPattern) ;
        }
           
        OpSequence opSeq = OpSequence.create() ;
       
        for ( Triple t : basicPattern )
        {
            // One expansion for each triple pattern.
            Op union = null ;
            for ( Node n : graphs )
            {
                BasicPattern bp = new BasicPattern() ;
                bp.add(t) ;
                Op pattern = new OpQuadPattern(n, bp) ;
                union = OpUnion.create(union, pattern) ;
            }
            opSeq.add(union) ;
        }
       
        // More than one graph - make distinct
        return new OpDistinct(opSeq) ;
    }
View Full Code Here

        if (op instanceof OpBGP)
            return (OpBGP) op;

        if (op instanceof OpSequence) {
            // Is last in OpSequence an BGP?
            OpSequence opSeq = (OpSequence) op;
            List<Op> x = opSeq.getElements();
            if (x.size() > 0) {
                Op opTop = x.get(x.size() - 1);
                if (opTop instanceof OpBGP)
                    return (OpBGP) opTop;
                // Drop through
View Full Code Here

        if (op instanceof OpQuadPattern)
            return (OpQuadPattern) op;

        if (op instanceof OpSequence) {
            // Is last in OpSequence an BGP?
            OpSequence opSeq = (OpSequence) op;
            List<Op> x = opSeq.getElements();
            if (x.size() > 0) {
                Op opTop = x.get(x.size() - 1);
                if (opTop instanceof OpQuadPattern)
                    return (OpQuadPattern) opTop;
                // Drop through
View Full Code Here

            // Nothing to do here.
            return super.transform(opSequence, elts) ;
       
       
       
        OpSequence seq2 = OpSequence.create() ;

        for ( int i = 0 ; i < elts.size() ; i++ )
        {
            Op op = elts.get(i) ;

            BasicPattern p1 = asBGP(op) ;
            if ( p1 == null )
            {
                // Do nothing
                seq2.add(op) ;
                continue ; // Outer loop.
            }

            // This is the op after the merge, if any.
            BasicPattern pMerge = new BasicPattern() ;
            seq2.add(new OpBGP(pMerge)) ;
            // Merge any BGPs from here on ...
            // Re-gets the BGP that trigegrs this all.
            for ( ; i < elts.size() ; i++ )
            {
                // Look at next element.
                Op opNext = elts.get(i) ;

                BasicPattern p2 = asBGP(opNext) ;
                if ( p2 == null )
                {
                    seq2.add(opNext) ;
                    break ;
                }

                // Merge.
                pMerge.addAll(p2) ;
            }
        }
        if ( seq2.size() == 1 )
            return seq2.get(0) ;
        return seq2 ;
    }
View Full Code Here

            // Simple rewrite.
            Node n = graphs.iterator().next() ;
            return new OpQuadPattern(n, basicPattern) ;
        }
           
        OpSequence opSeq = OpSequence.create() ;
       
        for ( Triple t : basicPattern )
        {
            // One expansion for each triple pattern.
            Op union = null ;
            for ( Node n : graphs )
            {
                BasicPattern bp = new BasicPattern() ;
                bp.add(t) ;
                Op pattern = new OpQuadPattern(n, bp) ;
                union = OpUnion.create(union, pattern) ;
            }
            opSeq.add(union) ;
        }
       
        // More than one graph - make distinct
        return new OpDistinct(opSeq) ;
    }
View Full Code Here

            return (OpBGP)op ;
       
        if ( op instanceof OpSequence )
        {
            // Is last in OpSequence an BGP?
            OpSequence opSeq = (OpSequence)op ;
            List<Op> x = opSeq.getElements() ;
            if ( x.size() > 0 )
            {               
                Op opTop = x.get(x.size()-1) ;
                if ( opTop instanceof OpBGP )
                    return (OpBGP)opTop ;
View Full Code Here

            return (OpQuadPattern)op ;
       
        if ( op instanceof OpSequence )
        {
            // Is last in OpSequence an BGP?
            OpSequence opSeq = (OpSequence)op ;
            List<Op> x = opSeq.getElements() ;
            if ( x.size() > 0 )
            {               
                Op opTop = x.get(x.size()-1) ;
                if ( opTop instanceof OpQuadPattern )
                    return (OpQuadPattern)opTop ;
View Full Code Here

            // Nothing to do here.
            return super.transform(opSequence, elts) ;
       
       
       
        OpSequence seq2 = OpSequence.create() ;

        for ( int i = 0 ; i < elts.size() ; i++ )
        {
            Op op = elts.get(i) ;

            BasicPattern p1 = asBGP(op) ;
            if ( p1 == null )
            {
                // Do nothing
                seq2.add(op) ;
                continue ; // Outer loop.
            }

            // This is the op after the merge, if any.
            BasicPattern pMerge = new BasicPattern() ;
            seq2.add(new OpBGP(pMerge)) ;
            // Merge any BGPs from here on ...
            // Re-gets the BGP that trigegrs this all.
            for ( ; i < elts.size() ; i++ )
            {
                // Look at next element.
                Op opNext = elts.get(i) ;

                BasicPattern p2 = asBGP(opNext) ;
                if ( p2 == null )
                {
                    seq2.add(opNext) ;
                    break ;
                }

                // Merge.
                pMerge.addAll(p2) ;
            }
        }
        if ( seq2.size() == 1 )
            return seq2.get(0) ;
        return seq2 ;
    }
View Full Code Here

            return (OpBGP)op ;
       
        if ( op instanceof OpSequence )
        {
            // Is last in OpSequence an BGP?
            OpSequence opSeq = (OpSequence)op ;
            List<Op> x = opSeq.getElements() ;
            if ( x.size() > 0 )
            {               
                Op opTop = x.get(x.size()-1) ;
                if ( opTop instanceof OpBGP )
                    return (OpBGP)opTop ;
View Full Code Here

TOP

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

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.