Inline images are not allowed here, thus we can't see anything. And a
screenshot of Protege is not really helpful.

Prefixes might be wrong. We neither know the final query, nor your code.

Please show a sample of the data in best case in Turtle format. And the
final query - please not again as Java concatenated String but as the
output from System.out.println(query2)



On 09.01.2017 15:06, javed khan wrote:
> Inline image 1
>
>
> It shows the result in Protege: Mac is student name and 6 is highscore
> of English category scored by him.
>
> On Mon, Jan 9, 2017 at 4:34 PM, Andy Seaborne <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Maybe there are no results.
>
>     This is not a complete, minimal example. Unseen details probably
>     matter.
>
>         Andy
>
>
>     On 09/01/17 13:28, javed khan wrote:
>
>         Hello Lorenz, yes I need student and highscore.
>
>         I just tried this , no exception but it does not display the
>         message in
>         JOptionPane.showMessageDialog()
>
>          Query query2 = QueryFactory.create(queryString2);
>         QueryExecution qexec = QueryExecutionFactory.create(query2,
>         model) ;
>         ResultSet results2 = qexec.execSelect() ;
>
>              RDFNode r;
>              while(results2.hasNext()){
>
>             QuerySolution sol= results2.nextSolution();
>               r=sol.get("student");
>                JOptionPane.showMessageDialog(null,"high score is" + r );
>              }
>
>         On Mon, Jan 9, 2017 at 1:42 PM, Lorenz Buehmann <
>         [email protected]
>         <mailto:[email protected]>> wrote:
>
>             @ As per the previous discussion, I guess he also wants to
>             have the
>             student - and of course the highest score,
>
>             As Chris said, you have to distinguish between literals
>             and URIs/blank
>             nodes.
>
>             Which finally leads me to the suggestion to read an RDF
>             tutorial +
>             SPARQL tutorial first. Most questions are really basic.
>
>
>             On 09.01.2017 09:38, Chris Dollin wrote:
>
>
>
>                 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
>                     <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
>
>
>
>
>

Reply via email to