Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.InstantiationError while running sparql query in jena
    text
    copied!<p>Dear Friends I m using Jena framework with RDF database model with virtuoso in my project. my jena version is jena-core2.7.2 and jena-arq-2.9.2</p> <p>Here is the my code which is giving me error</p> <pre><code>public JsonArray getCountryAutoSuggestData() { JsonArray countryArray = new JsonArray(); Model model = DataModel.getModel(); String mystr = " PREFIX plcontologyurl:&lt;http://www.plcontology.com/#&gt; " + " PREFIX rdf:&lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; " + "select ?cn" + " where " + " { " + " ?d plcontologyurl:Country_Name ?cn . " + "}"; Query query = QueryFactory.create(mystr); QueryExecution qe = QueryExecutionFactory.create(query, model); QuerySolutionMap qMap = new QuerySolutionMap(); qe.setInitialBinding(qMap); ResultSet rs = qe.execSelect(); while(rs.hasNext()) { qMap = (QuerySolutionMap)rs.next(); countryArray.add(new JsonPrimitive(qMap.getLiteral("cn").getString())); } return countryArray; } </code></pre> <p>Error is java.lang.InstantiationError: com.hp.hpl.jena.sparql.engine.binding.BindingMap at line while(rs.hasNext())</p> <p>I tried looking for the problem and I found one <a href="http://www.mail-archive.com/owlim-discussion@ontotext.com/msg01415.html" rel="nofollow">relevant discussion</a></p> <p>They are saying that now com.hp.hpl.jena.sparql.engine.binding.BindingMap is not a simple class now in this version but an interface now.</p> <p>If it is like that then how to run sparql query in the current version. Please give an example based on the code i have shared. Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload