Package com.hp.hpl.jena.sparql.engine.iterator

Examples of com.hp.hpl.jena.sparql.engine.iterator.QueryIterConcat


    // Brute force evaluation of a TriplePath where neither subject nor object are bound
    private static QueryIterator ungroundedPath(Binding binding, Graph graph, Var sVar, Path path, Var oVar,
                                                ExecutionContext execCxt)
    {
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, sVar, n) ;
            Iterator<Node> pathIter = PathEval.eval(graph, n, path, execCxt.getContext()) ;
            QueryIterator qIter = _execTriplePath(b2, pathIter, oVar, execCxt) ;
            qIterCat.add(qIter) ;
        }
        return qIterCat ;
    }
View Full Code Here


    private static QueryIterator ungroundedPathSameVar(Binding binding, Graph graph, Var var, Path path, ExecutionContext execCxt)
    {
        // Try each end, grounded 
        // Slightly more efficient would be to add a per-engine to do this.
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, var, n) ;
            int x = existsPath(graph, n, path, n, execCxt) ;
            if ( x > 0 )
            {
                QueryIterator qIter = new QueryIterYieldN(x, b2, execCxt) ;
                qIterCat.add(qIter) ;
            }
        }
        return qIterCat ;
    }
View Full Code Here

        else
        {
            // Variable.
            Var gVar = Var.alloc(opQuad.getGraphNode()) ;
            // Or just just devolve to OpGraph and get OpUnion chain of OpJoin
            QueryIterConcat concat = new QueryIterConcat(cxt) ;
            for ( Iterator<Node> graphNodes = cxt.getDataset().listGraphNodes() ; graphNodes.hasNext(); )
            {
                Node gn = graphNodes.next() ;
                //Op tableVarURI = TableFactory.create(gn.getName(), Node.createURI(uri)) ;
               
                Graph g = cxt.getDataset().getGraph(gn) ;
                Binding b = BindingFactory.binding(BindingRoot.create(), gVar, gn) ;
                ExecutionContext cxt2 = new ExecutionContext(cxt, g) ;

                // Eval the pattern, eval the variable, join.
                // Pattern may be non-linear in the variable - do a pure execution. 
                Table t1 = TableFactory.create(gVar, gn) ;
                QueryIterator qIter = executeBGP(pattern, QueryIterRoot.create(cxt2), cxt2) ;
                Table t2 = TableFactory.create(qIter) ;
                Table t3 = evaluator.join(t1, t2) ;
                concat.add(t3.iterator(cxt2)) ;
            }
            return TableFactory.create(concat) ;
        }
    }
View Full Code Here

    }

    @Override
    protected QueryIterator nextStage(Binding binding)
    {
        QueryIterConcat unionQIter = new QueryIterConcat(getExecContext()) ;
        for (Op subOp : subOps)
        {
            subOp = QC.substitute(subOp, binding) ;
            QueryIterator parent = QueryIterSingleton.create(binding, getExecContext()) ;
            QueryIterator qIter = QC.execute(subOp, parent, getExecContext()) ;
            unionQIter.add(qIter) ;
        }
       
        return unionQIter ;
    }
View Full Code Here

    // Brute force evaluation of a TriplePath where neither subject nor object are bound
    private static QueryIterator ungroundedPath(Binding binding, Graph graph, Var sVar, Path path, Var oVar,
                                                ExecutionContext execCxt)
    {
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, sVar, n) ;
            Iterator<Node> pathIter = PathEval.eval(graph, n, path) ;
            QueryIterator qIter = _execTriplePath(b2, pathIter, oVar, execCxt) ;
            qIterCat.add(qIter) ;
        }
        return qIterCat ;
    }
View Full Code Here

    private static QueryIterator ungroundedPathSameVar(Binding binding, Graph graph, Var var, Path path, ExecutionContext execCxt)
    {
        // Try each end, grounded 
        // Slightly more efficient would be to add a per-engine to do this.
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, var, n) ;
            int x = existsPath(graph, n, path, n) ;
            if ( x > 0 )
            {
                QueryIterator qIter = new QueryIterYieldN(x, b2, execCxt) ;
                qIterCat.add(qIter) ;
            }
        }
        return qIterCat ;
    }
View Full Code Here

    // Brute force evaluation of a TriplePath where neither subject nor object are bound
    private static QueryIterator ungroundedPath(Binding binding, Graph graph, Var sVar, Path path, Var oVar,
                                                ExecutionContext execCxt)
    {
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, sVar, n) ;
            Iterator<Node> pathIter = PathEval.eval(graph, n, path) ;
            QueryIterator qIter = _execTriplePath(b2, pathIter, oVar, execCxt) ;
            qIterCat.add(qIter) ;
        }
        return qIterCat ;
    }
View Full Code Here

    // Brute force evaluation of a TriplePath where neither subject nor object are bound
    private static QueryIterator ungroundedPath(Binding binding, Graph graph, Var sVar, Path path, Var oVar,
                                                ExecutionContext execCxt)
    {
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, sVar, n) ;
            Iterator<Node> pathIter = PathEval.eval(graph, n, path, execCxt.getContext()) ;
            QueryIterator qIter = _execTriplePath(b2, pathIter, oVar, execCxt) ;
            qIterCat.add(qIter) ;
        }
        return qIterCat ;
    }
View Full Code Here

    private static QueryIterator ungroundedPathSameVar(Binding binding, Graph graph, Var var, Path path, ExecutionContext execCxt)
    {
        // Try each end, grounded 
        // Slightly more efficient would be to add a per-engine to do this.
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, var, n) ;
            int x = existsPath(graph, n, path, n, execCxt) ;
            if ( x > 0 )
            {
                QueryIterator qIter = new QueryIterYieldN(x, b2, execCxt) ;
                qIterCat.add(qIter) ;
            }
        }
        return qIterCat ;
    }
View Full Code Here

        else
        {
            // Variable.
            Var gVar = Var.alloc(opQuad.getGraphNode()) ;
            // Or just just devolve to OpGraph and get OpUnion chain of OpJoin
            QueryIterConcat concat = new QueryIterConcat(cxt) ;
            for ( Iterator<Node> graphNodes = cxt.getDataset().listGraphNodes() ; graphNodes.hasNext(); )
            {
                Node gn = graphNodes.next() ;
                //Op tableVarURI = TableFactory.create(gn.getName(), Node.createURI(uri)) ;
               
                Graph g = cxt.getDataset().getGraph(gn) ;
                Binding b = BindingFactory.binding(BindingRoot.create(), gVar, gn) ;
                ExecutionContext cxt2 = new ExecutionContext(cxt, g) ;

                // Eval the pattern, eval the variable, join.
                // Pattern may be non-linear in the variable - do a pure execution. 
                Table t1 = TableFactory.create(gVar, gn) ;
                QueryIterator qIter = executeBGP(pattern, QueryIterRoot.create(cxt2), cxt2) ;
                Table t2 = TableFactory.create(qIter) ;
                Table t3 = evaluator.join(t1, t2) ;
                concat.add(t3.iterator(cxt2)) ;
            }
            return TableFactory.create(concat) ;
        }
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.engine.iterator.QueryIterConcat

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.