Examples of nextSolution()


Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

           
            // The order of results is undefined.
            System.out.println("Titles: ") ;
            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

            ResultSet rs = qexec.execSelect() ;
           
            // The order of results is undefined.
            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

           
            // The order of results is undefined.
            System.out.println("Titles: ") ;
            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

   
    ResultSet res = qe.execSelect();
   
    assertTrue("I have results", res.hasNext());
   
    QuerySolution soln = res.nextSolution();
   
    RDFNode subj = soln.get("subj");
       
    assertEquals("Result is correct", "urn:ex:TABLE1;FIELD1=2;FIELD3=3", ((Resource) subj).getURI());
   
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

   
    QueryEngine qe = new LdapQueryEngine(query, config);
    qe.setDataset(DatasetFactory.create());
    ResultSet res = qe.execSelect();
    assertTrue("I have results", res.hasNext());
    QuerySolution result = res.nextSolution();
    assertTrue("I have a country", result.contains("country"));
    assertEquals("I have the correct country", Node.createLiteral("GB"), result.get("country").asNode());
  }
 
  /* As above, but ASK */
 
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

        QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
        try {
          ResultSet results = qexec.execSelect() ;
          for ( ; results.hasNext() ; )
          {
              QuerySolution soln = results.nextSolution() ;
              int count = soln.getLiteral("count").getInt() ;
              System.out.println("count = "+count) ;
          }
        } finally { qexec.close() ; }
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

        QueryExecution qe=QueryExecutionFactory.create(q,m);
        ResultSet r=qe.execSelect();
        assertEquals(1,r.getResultVars().size());
        assertEquals("dayName",r.getResultVars().get(0));
        assertTrue(r.hasNext());
        QuerySolution qs=r.nextSolution();
        assertEquals("Sunday",qs.get("dayName").asLiteral().getLexicalForm())
    }
}
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

            List<String> vars=results.getResultVars();
            if(vars.size()!=1) {
                throw new Exception("Scalar query returns other than one column");
            }

            QuerySolution row=results.nextSolution();
            RDFNode value=row.get(vars.get(0));
            if (results.hasNext()) {
                throw new Exception("Scalar query returns more than one row");
            }
            return value;
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

            ResultSet results=qe.execSelect();
            Map<RDFNode,RDFNode> map=Maps.newHashMap();
            List<String> vars=results.getResultVars();

            while(results.hasNext()) {
                QuerySolution row=results.nextSolution();
                map.put(row.get(vars.get(0)),row.get(vars.get(1)));
            }
            return map;
        } finally { qe.close(); }
    }
View Full Code Here

Examples of com.hp.hpl.jena.query.ResultSet.nextSolution()

            Set<RDFNode> seen=Sets.newHashSet();
            Map<RDFNode,RDFNode> map=Maps.newHashMap();
            List<String> vars=results.getResultVars();

            while(results.hasNext()) {
                QuerySolution row=results.nextSolution();
                RDFNode key=row.get(vars.get(0));
                if(seen.contains(key)) {
                    map.remove(key);
                } else {
                    seen.add(key);
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.