Package com.hp.hpl.jena.sparql.core

Examples of com.hp.hpl.jena.sparql.core.PathBlock


            out.println("# Empty BGP") ;
            return ;
        }
        // Could be neater.
        boolean first = true ;
        PathBlock pBlk = el.getPattern() ;
        for ( TriplePath tp : pBlk )
        {
            if ( ! first )
            {
                out.println(" .") ;
View Full Code Here


            out.println("# Empty BGP") ;
            return ;
        }
        // Could be neater.
        boolean first = true ;
        PathBlock pBlk = el.getPattern() ;
        for ( TriplePath tp : pBlk )
        {
            if ( ! first )
            {
                out.println(" .") ;
View Full Code Here

   
    @Override
    public Op transform(OpPath opPath)
    {
        // Flatten down to triples where possible.
        PathBlock pattern = pathCompiler.reduce(opPath.getTriplePath()) ;
        // Any generated paths of exactly one to triple; convert to Op.
        return PathLib.pathToTriples(pattern) ;
    }
View Full Code Here

    // ---- Syntax-based
   
    /** Simplify : turns constructs in simple triples and simpler TriplePaths where possible */
    public PathBlock reduce(PathBlock pathBlock)
    {
        PathBlock x = new PathBlock() ;
        // No context during algebra generation time.
//        VarAlloc varAlloc = VarAlloc.get(context, ARQConstants.sysVarAllocNamed) ;
//        if ( varAlloc == null )
//            // Panic
//            throw new ARQInternalErrorException("No execution-scope allocator for variables") ;
View Full Code Here

    }
   
    // ---- Algebra-based transformation.
    public PathBlock reduce(TriplePath triplePath)
    {
        PathBlock x = new PathBlock() ;
        reduce(x, varAlloc, triplePath.getSubject(), triplePath.getPath(), triplePath.getObject()) ;
        return x ;
    }
View Full Code Here

        return x ;
    }
   
    public PathBlock reduce(Node start, Path path, Node finish)
    {
        PathBlock x = new PathBlock() ;
        reduce(x, varAlloc, start, path, finish) ;
        return x ;
    }
View Full Code Here

            return groupElt.getElements() ;
       
        List<Element> groupElts = new ArrayList<Element>() ;
        BasicPattern prev = null ;
        List<ElementFilter> filters = null ;
        PathBlock prev2 = null ;
       
        for (Element elt : groupElt.getElements() )
        {
            if ( elt instanceof ElementFilter )
            {
                ElementFilter f = (ElementFilter)elt ;
                if ( filters == null )
                    filters = new ArrayList<ElementFilter>() ;
                filters.add(f) ;
                // Collect filters but do not place them yet.
                continue ;
            }
           
            if ( elt instanceof ElementTriplesBlock )
            {
                if ( prev2 != null )
                    throw new ARQInternalErrorException("Mixed ElementTriplesBlock and ElementPathBlock (case 1)") ;
               
                ElementTriplesBlock etb = (ElementTriplesBlock)elt ;

                if ( prev != null )
                {
                    // Previous was an ElementTriplesBlock.
                    // Merge because they were adjacent in a group
                    // in syntax, so it must have been BGP, Filter, BGP.
                    // Or someone constructed a non-serializable query.
                    prev.addAll(etb.getPattern()) ;
                    continue ;
                }
                // New BGP.
                // Copy - so that any later mergings do not change the original query.

                ElementTriplesBlock etb2 = new ElementTriplesBlock() ;
                etb2.getPattern().addAll(etb.getPattern()) ;
                prev = etb2.getPattern() ;
                groupElts.add(etb2) ;
                continue ;
            }
           
            // TIDY UP - grr this is duplication.
            // Can't mix ElementTriplesBlock and ElementPathBlock (which subsumes ElementTriplesBlock)
            if ( elt instanceof ElementPathBlock )
            {
                if ( prev != null )
                    throw new ARQInternalErrorException("Mixed ElementTriplesBlock and ElementPathBlock (case 2)") ;
               
                ElementPathBlock epb = (ElementPathBlock)elt ;
                if ( prev2 != null )
                {
                    prev2.addAll(epb.getPattern()) ;
                    continue ;
                }
               
                ElementPathBlock epb2 = new ElementPathBlock() ;
                epb2.getPattern().addAll(epb.getPattern()) ;
View Full Code Here

            out.println("# Empty BGP") ;
            return ;
        }
        // Could be neater.
        boolean first = true ;
        PathBlock pBlk = el.getPattern() ;
        for ( TriplePath tp : pBlk )
        {
            if ( ! first )
            {
                out.println(" .") ;
View Full Code Here

            out.println("# Empty BGP") ;
            return ;
        }
        // Could be neater.
        boolean first = true ;
        PathBlock pBlk = el.getPattern() ;
        for ( TriplePath tp : pBlk )
        {
            if ( ! first )
            {
                out.println(" .") ;
View Full Code Here

            out.println("# Empty BGP") ;
            return ;
        }
        // Could be neater.
        boolean first = true ;
        PathBlock pBlk = el.getPattern() ;
        for ( TriplePath tp : pBlk )
        {
            if ( ! first )
            {
                out.println(" .") ;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.core.PathBlock

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.