Examples of QueryIterator


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

   
    map.addTriple(Triple.create("?paul http://xmlns.com/foaf/0.1/name 'Paul\\sShabajee'"));
    map.addTriple(Triple.create("?paul http://jena.hpl.hp.com/schemas/hpcorp#manager ?manager"));
    map.addTriple(Triple.create("?manager http://xmlns.com/foaf/0.1/name ?name"));
   
    QueryIterator results = new QueryIterSingleton(new BindingRoot());
   
    results = map.execute(results, null);
   
    assertTrue("I have a manager for Paul", results.hasNext());
   
    Binding binding = results.nextBinding();
   
    assertEquals("I have the right manager for Paul", Node.createLiteral("Martin John Merry"), binding.get("name"));
  }
View Full Code Here

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

   
    map.addTriple(Triple.create("?person http://xmlns.com/foaf/0.1/mbox mailto:martin.merry@hp.com"));
    map.addTriple(Triple.create("?underling http://jena.hpl.hp.com/schemas/hpcorp#manager ?person"));
    map.addTriple(Triple.create("?underling http://xmlns.com/foaf/0.1/name ?name"));
   
    QueryIterator results = new QueryIterSingleton(new BindingRoot());
   
    results = map.execute(results, null);
   
    assertTrue("I got a result", results.hasNext());
   
    while (results.hasNext())
    {
      Binding nextBinding = results.nextBinding();
      log.info("Name: " + nextBinding.get("name"));
    }
  }
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(FmtUtils.stringForNode(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, Ex1.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

            return other.execute(pattern, input, execCxt) ;
       
        System.err.println("MyStageGenerator.compile:: triple patterns = "+pattern.size()) ;

        // Stream the triple matches together, one triple matcher at a time.
        QueryIterator qIter = input ;
        for (Triple triple : pattern.getList())
            qIter = new QueryIterTriplePattern(qIter, triple, execCxt) ;
        return qIter ;
    }
View Full Code Here

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

            // Put in a VALUES
            // This may be related to the grpup of the overall query.
           
            ElementData el = new ElementData() ;
            el.getVars().addAll(opTable.getTable().getVars()) ;
            QueryIterator qIter = opTable.getTable().iterator(null) ;
            while(qIter.hasNext())
                el.getRows().add(qIter.next()) ;
            qIter.close() ;
            currentGroup().addElement(el) ;
        }
View Full Code Here

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

       
//        List<Node> x = Iter.toList(graphNameNodes) ;
//        graphNameNodes = x.iterator() ;
//        System.out.println(x) ;
       
        QueryIterator current = new QueryIterGraphInner(
                                               outerBinding, graphNameNodes,
                                               opGraph, getExecContext()) ;
        return current ;
    }
View Full Code Here

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

        {
            if ( ! graphNames.hasNext() )
                return null ;
            Node gn = graphNames.next() ;

            QueryIterator qIter = buildIterator(parentBinding, gn, opGraph, getExecContext()) ;
            if ( qIter == null )
                // Know to be nothing (e.g. graph does not exist).
                return null ;
           
            if ( Var.isVar(opGraph.getNode()) )
View Full Code Here

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

            if ( g == null )
                return null ;
                //throw new ARQInternalErrorException(".containsGraph was true but .getGraph is null") ;
           
            ExecutionContext cxt2 = new ExecutionContext(outerCxt, g) ;
            QueryIterator subInput = QueryIterSingleton.create(binding, cxt2) ;
            return QC.execute(op, subInput, cxt2) ;
        }
View Full Code Here

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

            Iterator<QueryIterator> iterAll = execContext.listAllIterators() ;

            if ( iterAll != null )
                while(iterAll.hasNext())
                {
                    QueryIterator qIter = iterAll.next() ;
                    warn(qIter, "Iterator: ") ;
                }
        }

        Iterator<QueryIterator> iterOpen = execContext.listOpenIterators() ;
        while(iterOpen.hasNext())
        {
            QueryIterator qIterOpen = iterOpen.next() ;
            warn(qIterOpen, "Open iterator: ") ;
            iterOpen.remove() ;
        }
    
    }
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.