Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.QuerySolution


      resultMap = new HashMap<String,Map<String,String>>() ;
    }
   
    if (results != null) {
      while ( results.hasNext() ) {
        QuerySolution soln = results.nextSolution() ;
        Resource res = (Resource)(soln.get("resource"));
        String resName = res.getURI() ;
        resultMap.put(resName, new HashMap<String,String>()) ;
       
        if ( _VERBOSE ){System.out.println(" - <" + resName + "> : "); }
       
View Full Code Here


    }

    private void processClassResultSet(ResultSet result, String keyword, List<RelatedKeyword> relatedKeywords) {
        Map<String,Double> results = new HashMap<String,Double>();
        while (result.hasNext()) {
            QuerySolution resultBinding = result.nextSolution();
            RDFNode rdfNode = resultBinding.get("class");
            double score = resultBinding.getLiteral("score").getDouble();
            if (rdfNode.isURIResource()) {
                String uri = rdfNode.asResource().getURI();
                results.put(uri, score);
            }
        }
View Full Code Here

    private void processIndividualResultSet(ResultSet result,
                                            String keyword,
                                            List<RelatedKeyword> relatedKeywords) {
        Map<String,Double> results = new HashMap<String,Double>();
        while (result.hasNext()) {
            QuerySolution resultBinding = result.nextSolution();
            RDFNode rdfNode = resultBinding.get("individual");
            double score = resultBinding.getLiteral("score").getDouble();
            if (rdfNode.isURIResource()) {
                String uri = rdfNode.asResource().getURI();
                results.put(uri, score);
            }
        }
View Full Code Here

    private void processCMSObjectResultSet(ResultSet result,
                                           String keyword,
                                           List<RelatedKeyword> relatedKeywords) {
        Map<String,Double> results = new HashMap<String,Double>();
        while (result.hasNext()) {
            QuerySolution resultBinding = result.nextSolution();
            RDFNode rdfNode = resultBinding.get("cmsobject");
            double score = resultBinding.getLiteral("score").getDouble();
            if (rdfNode.isURIResource()) {
                String uri = rdfNode.asResource().getURI();
                results.put(uri, score);
            }
        }
View Full Code Here

   
    QueryExecution qexec = QueryExecutionFactory.create(query, csv);
    ResultSet results = qexec.execSelect();
   
    assertTrue(results.hasNext());
    QuerySolution soln = results.nextSolution();
    assertEquals( "Northville", soln.getLiteral("townName").getString());
    assertTrue( 654000 == soln.getLiteral("pop").getInt());
   
    assertFalse(results.hasNext());
  }
View Full Code Here

   
    QueryExecution qexec = QueryExecutionFactory.create(query, csv);
    ResultSet results = qexec.execSelect();
   
    assertTrue(results.hasNext());
    QuerySolution soln = results.nextSolution();
    assertEquals( "David Sweeney", soln.getLiteral("name").getString());
    assertEquals( "Research, Innovation and Skills", soln.getLiteral("unit").getString());
   
    assertFalse(results.hasNext());
  }
View Full Code Here

   
    QueryExecution qexec = QueryExecutionFactory.create(query, csv);
    ResultSet results = qexec.execSelect();
   
    assertTrue(results.hasNext());
    QuerySolution soln = results.nextSolution();
    assertEquals( "Oshrat Raz,Dorit L Lev,Alexander Battler,Eli I Lev", soln.getLiteral("author").getString());
   
    assertFalse(results.hasNext());
  }
View Full Code Here

   
    QueryExecution qexec = QueryExecutionFactory.create(query, csv);
    ResultSet results = qexec.execSelect();
   
    assertTrue(results.hasNext());
    QuerySolution soln = results.nextSolution();
    assertEquals( -122.1566921, soln.getLiteral("longitude").getDouble(), 0);
    assertEquals( 37.4408948, soln.getLiteral("latitude").getDouble(), 0);
   
    assertFalse(results.hasNext());
  }
View Full Code Here

        // Preparation pass : find the maximum width for each column
        for ( ; rs.hasNext() ; )
        {
            numRows++ ;
            QuerySolution rBind = rs.nextSolution() ;
            int col = -1 ;
            for ( Iterator<String> iter = rs.getResultVars().iterator() ; iter.hasNext() ; )
            {
                col++ ;
                String rVar = iter.next() ;
View Full Code Here

            pw.print('=') ;
        pw.println() ;

        for ( ; resultSetRewindable.hasNext() ; )
        {
            QuerySolution rBind = resultSetRewindable.nextSolution() ;
            for ( int col = 0 ; col < numCols ; col++ )
            {
                String rVar = resultSet.getResultVars().get(col) ;
                row[col] = this.getVarValueAsString(rBind, rVar );
            }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.query.QuerySolution

Copyright © 2018 www.massapicom. 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.