Package com.hp.hpl.jena.query

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


        try {
            ResultSet rs = qExec.execSelect() ;
            assertTrue(rs.hasNext()) ;
            qExec.abort();
            assertTrue(rs.hasNext()) ;
            rs.nextSolution();
            assertFalse("Results not expected after cancel.", rs.hasNext()) ;
        } finally { qExec.close() ; }
    }   
   
    @Test public void test_Cancel_API_3() throws InterruptedException
View Full Code Here


            try
            {
                ResultSet rs = qExec.execSelect() ;
                while ( rs.hasNext() )
                {
                    rs.nextSolution() ;
                    count++ ;
                    synchronized (qExec) { qExec.notify() ; }
                    synchronized (qExec) { qExec.wait() ; }
                }
        }
View Full Code Here

    {
        QueryExecution qExec = makeQExec("SELECT * {?s ?p ?o}") ;
        try {
            ResultSet rs = qExec.execSelect() ;
            assertTrue("No results", rs.hasNext()) ;
            QuerySolution qs = rs.nextSolution() ;
            Resource qr = qs.getResource("s") ;
            assertSame("Not the same model as queried", qr.getModel(), m) ;
        } finally { qExec.close() ; }
       
    }
View Full Code Here

        QueryExecution qExec = makeQExec("SELECT * {?s ?p 'x1'}") ;
        QuerySolutionMap init = new QuerySolutionMap() ;
        init.add("z", m.createLiteral("zzz"));
        qExec.setInitialBinding(init) ;
        ResultSet rs = qExec.execSelect() ;
        QuerySolution qs = rs.nextSolution() ;
        assertTrue("Initial setting not set correctly now", qs.getLiteral("z").getLexicalForm().equals("zzz")) ;
        qExec.close() ;
    }
   
    @Test public void testInitialBindings4()
View Full Code Here

        map.add("this", OWL.Thing);
        qexec.setInitialBinding(map);
       
        ResultSet rs = qexec.execSelect();
        while(rs.hasNext()) {
            QuerySolution qs = rs.nextSolution();
            //System.out.println("Result: " + qs);
        }
        qexec.close() ;
    }
   
View Full Code Here

        Query q = QueryFactory.create(queryString) ;
       
        QueryExecution qExec = QueryExecutionFactory.create(q, m) ;
       
        ResultSet rs = qExec.execSelect() ;
        QuerySolution qs = rs.nextSolution() ;
        assertEquals(3, qs.getLiteral("c").getInt()) ;
        qExec.close() ;
       
        qExec = QueryExecutionFactory.create(q, m) ;
        rs = qExec.execSelect() ;
View Full Code Here

        assertEquals(3, qs.getLiteral("c").getInt()) ;
        qExec.close() ;
       
        qExec = QueryExecutionFactory.create(q, m) ;
        rs = qExec.execSelect() ;
        qs = rs.nextSolution() ;
        assertEquals(3, qs.getLiteral("c").getInt()) ;
        qExec.close() ;
    }
   
    @Test public void testConstructRejectsBadTriples1()
View Full Code Here

        query("SELECT ?root " +
          "WHERE { ?layer a <"+powla_DocumentLayer+">. " +
              "?layer <"+powla_hasDocument+"> <"+document+">. " +
              "?layer <"+powla_rootOfDocument+"> ?root }")
      while (results.hasNext())
          consolidateNodeExtensions(results.nextSolution().getResource("root"));

   
    return document;
  }
View Full Code Here

        query("SELECT ?root " +
          "WHERE { ?layer a <"+powla_DocumentLayer+">. " +
              "?layer <"+powla_hasDocument+"> <"+document+">. " +
              "?layer <"+powla_rootOfDocument+"> ?root }")
      while (results.hasNext())
          consolidateNodeExtensions(results.nextSolution().getResource("root"));

   
    return document;
  }
       
View Full Code Here

    Map<String, String> result = new HashMap<String, String>();
    QueryExecution qe = QueryExecutionFactory.create(QueryFactory.create(sparql), model);
    try {
      ResultSet rs = qe.execSelect();
      while (rs.hasNext()) {
        QuerySolution sol = rs.nextSolution();
        for (Iterator<String> varNames = sol.varNames(); varNames.hasNext(); ) {
          String varName = varNames.next();
          result.put(varName, sol.get(varName).toString());
        }
      }
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.