Once again you have failed to provide a minimal complete example. This means the minimal code needed to reproduce the problem and any extra resources needed e.g. your data. Complete means that your code should be able to be copied and pasted and run.
http://stackoverflow.com/help/mcve Note you haven’t actually told us what the problem is i.e. What is the specific error message you got. It gets an exception is not a problem statement! We have been telling you this for weeks, if you are not actually going to make an effort then people are going to stop trying to help you Rob On 26/01/2017 13:06, "javed khan" <[email protected]> wrote: *The following query works * : "SELECT ?student ?highScore " + " WHERE {" + " {"+ "select (max(?score) as ?highScore)" + " { ?student dd:Englishscore ?score" + " }" + " } " + "?student dd:Englishscore ?highScore" + "}"; Query query2 = QueryFactory.create(queryString2); QueryExecution qexec = QueryExecutionFactory.create(query2, model2) ; ResultSet results2 = qexec.execSelect() ; Literal r= results2.next().get("highScore").asLiteral(); String ss= r.getLexicalForm(); JOptionPane.showMessageDialog(null,"High score of Physics is"+s + "by Student"); This query now works but when I include also the student name, it gives me exception again. * Resource r2= results2.next().get("student").asResource();* * String s=r2.toString();*
