Examples of QueryIterator


Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

   
    // Ask directly.
    private QueryIterator execEvaluatedConcrete(Binding binding, Node containerNode, Node predicate, Node member,
                                                ExecutionContext execCxt)
    {
        QueryIterator input = QueryIterSingleton.create(binding, execCxt) ;
        Graph graph = execCxt.getActiveGraph() ;
        QueryIterator qIter = new QueryIterTriplePattern(input, new Triple(containerNode, predicate, member), execCxt) ;
        return qIter ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

        System.out.println("--------------") ;
        System.out.print(op) ;
        System.out.println("--------------") ;

        // ---- Execute expression
        QueryIterator qIter = Algebra.exec(op, m.getGraph()) ;
       
        // -------- Either read the query iterator directly ...
        if ( false )
        {
            for ( ; qIter.hasNext() ; )
            {
                Binding b = qIter.nextBinding() ;
                Node n = b.get(var_x) ;
                System.out.println(NodeFmtLib.displayStr(n)) ;
                System.out.println(b) ;
            }
            qIter.close() ;
        }
        else
        {
            // -------- Or make ResultSet from it (but not both - reading an
            //          iterator consumes the current solution)
            List<String> varNames = new ArrayList<String>() ;
            varNames.add("x") ;
            varNames.add("z") ;
            ResultSet rs = new ResultSetStream(varNames, m, qIter);
            ResultSetFormatter.out(rs) ;
            qIter.close() ;
        }
        System.exit(0) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

        Op op = Algebra.compile(query) ;
        op = Algebra.optimize(op) ;
        System.out.println(op) ;
       
        // Execute it.
        QueryIterator qIter = Algebra.exec(op, ExQuerySelect1.createModel()) ;
       
        // Results
        for ( ; qIter.hasNext() ; )
        {
            Binding b = qIter.nextBinding() ;
            System.out.println(b) ;
        }
        qIter.close() ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

        if ( context.isTrue(TDB.symUnionDefaultGraph) && ! doingDynamicDatasetBySpecialDataset )
        {
            op = A2.unionDefaultGraphQuads(op) ;
            Explain.explain("REWRITE(Union default graph)", op, context) ;
        }
        QueryIterator results = super.eval(op, dsg, input, context) ;
        results = new QueryIteratorMaterializeBinding(results) ;
        return results ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

    private Iterator<Triple> graphFindWorker(Graph graph, Node s, PropertyFunctionFactory f, Node p, Node o, Context context) {
        // Expensive?
        PropertyFunction pf = f.create(p.getURI()) ;
        PropFuncArg sv = arg(s, "S") ;
        PropFuncArg ov = arg(o, "O") ;
        QueryIterator r = QueryIterRoot.create(new ExecutionContext(context, graph, null, null)) ;
        QueryIterator qIter = pf.exec(r, sv, p, ov, new ExecutionContext(ARQ.getContext(), graph, null, null)) ;
        if ( ! qIter.hasNext() )
            return Iter.nullIterator() ;
        List<Triple> array = new ArrayList<Triple>() ;
        for ( ; qIter.hasNext() ; ) {
            Binding b = qIter.next() ;
            Node st = value(sv, b) ;
            Node ot = value(ov, b) ;
            array.add(Triple.create(st, p, ot)) ;
        }
        // Materialise so the inner QueryIterators are used up.
View Full Code Here

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

        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

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

            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

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

    public static void execute(Op op, DatasetGraph dsg) {
        execute(op, dsg, ResultsFormat.FMT_TEXT) ;
    }

    public static void execute(Op op, DatasetGraph dsg, ResultsFormat outputFormat) {
        QueryIterator qIter = Algebra.exec(op, dsg) ;

        List<String> vars = null ;
        if ( op instanceof OpProject )
            vars = Var.varNames(((OpProject)op).getVars()) ;
        else
View Full Code Here

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

        // Read the whole of the results now.
        // Avoids the problems with calling back into the same system e.g.
        // Fuseki+SERVICE <http://localhost:3030/...>

        ResultSet rs = ResultSetFactory.fromXML(in);
        QueryIterator qIter = new QueryIteratorResultSet(rs);
        qIter = QueryIter.materialize(qIter);
        // And close connection now, not when qIter is closed.
        IO.close(in);

        // In some cases we may need to apply a re-mapping
View Full Code Here

Examples of com.hp.hpl.jena.sparql.engine.QueryIterator

    }

    @Override
    public Table slice(Table table, long start, long length)
    {
        QueryIterator qIter = table.iterator(getExecContext()) ;
        qIter = new QueryIterSlice(qIter, start, length, getExecContext()) ;
        return new TableN(qIter) ;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.