Package com.hp.hpl.jena.query

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


      "    ?author foaf:name ?authorName ." +
      "}";
    Query q = QueryFactory.create(sparql);
    ResultSet rs = QueryExecutionFactory.create(q, m).execSelect();
    while (rs.hasNext()) {
      QuerySolution row = rs.nextSolution();
      System.out.println("Title: " + row.getLiteral("paperTitle").getString());
      System.out.println("Author: " + row.getLiteral("authorName").getString());
    }
    m.close();
  }
View Full Code Here


    Query query = QueryFactory.create(sparql);
    QueryExecution qe = QueryExecutionFactory.create(query, this.model);
    this.results = new HashSet<Map<String,RDFNode>>();
    ResultSet resultSet = qe.execSelect();
    while (resultSet.hasNext()) {
      QuerySolution solution = resultSet.nextSolution();
      addSolution(solution);
    }
  }
 
  private void addSolution(QuerySolution solution) {
View Full Code Here

            "    entityhub:localMode ?local . " +
            "} ";
    QueryExecution qe = QueryExecutionFactory.create(query, model);
    ResultSet results = qe.execSelect();
    if (results.hasNext()) {
      QuerySolution qs = results.nextSolution();
      ReconciliationStanbolSite reconciliation = new ReconciliationStanbolSite();
      reconciliation.setUri(site + RECONCILE_SUFFIX);
      reconciliation.setName(qs.getLiteral("name").getString());
      reconciliation.setLocal("true".equalsIgnoreCase(qs.getLiteral("local").getString()));
      return reconciliation;
View Full Code Here

  @Test
  public void sampleInstancesTest(){
    String sparql = factory.getSampleInstancesSparqlQuery("http://data.linkedmdb.org/resource/movie/film", ImmutableList.of("http://www.w3.org/2000/01/rdf-schema#label"), limit);
    ResultSet resultset = executor.sparql(sparql);
    assertTrue(resultset.hasNext());
    QuerySolution sol = resultset.nextSolution();
    assertFalse(sol.getLiteral("label1").getString().isEmpty());
    String uri1 = sol.getResource("entity").getURI();
   
    assertTrue(resultset.hasNext());
    sol = resultset.nextSolution();
View Full Code Here

    QuerySolution sol = resultset.nextSolution();
    assertFalse(sol.getLiteral("label1").getString().isEmpty());
    String uri1 = sol.getResource("entity").getURI();
   
    assertTrue(resultset.hasNext());
    sol = resultset.nextSolution();
    assertFalse(sol.getLiteral("label1").getString().isEmpty());
    assertFalse(uri1.equals(sol.getResource("entity").getURI()));
  }
 
  /*
 
View Full Code Here

    QueryExecution qexec = QueryExecutionFactory.create(query, model) ;
    ResultSet results = qexec.execSelect() ;
    try {
      for ( ; results.hasNext() ; )
      {
          QuerySolution soln = results.nextSolution() ;
          RDFNode facetvalue = soln.get("facet") ;
          RDFNode label = soln.get("label");
          RDFNode supercl = soln.get("superclass");

          Resource rfacetvalue = outputModel.createResource(facetvalue.toString(), RDFS.Class);
View Full Code Here

           
            // 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

           
            // 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

        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

        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

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.