On 08/01/17 18:32, javed khan wrote:
This query gives me exception:
Exception in thread "AWT-EventQueue-0"
com.hp.hpl.jena.rdf.model.LiteralRequiredException:
http://www.semanticweb.org/t/ontologies#Smith
"SELECT * " +
" WHERE {" + " {"+ "select (max(?score) as ?highScore)"
+ " { ?student std:Englishscore ?score" +
" }" +
" } " +
"?student std:Englishscore ?highScore" +
"}";
The variable ?subject will be the subject of a triple.
Subjects may be blank nodes or resources with URIs.
Query query2 = QueryFactory.create(queryString2);
QueryExecution qexec = QueryExecutionFactory.create(query2, model) ;
ResultSet results2 = qexec.execSelect() ;
Literal l2=results2.next().get("student").asLiteral();
get("student") will return the value of "student", which will
be a resource or blank node, but NOT a literal. asLiteral
expects a Literal.
BOOM.
My pre-caffeine guess is that you want "highscore" not "student".
As others have said, offer complete minimal examples.
Chris
--
"He could not weigh up which was worse and so tried not to think about either."
/The Spellgrinder's Apprentice/
Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)