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
Here is the my code which is giving me error
public JsonArray getCountryAutoSuggestData()
{
JsonArray countryArray = new JsonArray();
Model model = DataModel.getModel();
String mystr = " PREFIX plcontologyurl:<http://www.plcontology.com/#> "
+ " PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+ "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;
}
Error is java.lang.InstantiationError: com.hp.hpl.jena.sparql.engine.binding.BindingMap at line while(rs.hasNext())
I tried looking for the problem and I found one relevant discussion
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.
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.