salut
svp j'ai écrit cette requete SPARQL sous jena mais elle m'affiche une erreur !!!
voici la requête et aussi l'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 String queryString= "PREFIX dbpprop: <http://dbpedia.org/property/> "+ " PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>"+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "+ "PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> " + "SELECT ?player ?nam (count(?goals) AS ?Goals) ?labelPosition" + " where{"+ "?player a <http://dbpedia.org/ontology/SoccerPlayer> . "+ " ?player rdfs:label ?nam . "+ "?player dbpedia-owl:birthPlace ?pays . "+ "?pays dbpprop:commonName ?country . "+ "?player dbpedia-owl:position ?position ."+ "?position rdfs:label ?labelPosition. "+ "?player dbpprop:goals ?goals . "+ "FILTER langMatches(lang(?nam),'fr'). "+ "FILTER langMatches(lang(?labelPosition),'en'). "+ "FILTER regex(?country, \"^Morocco\")"+ " } GROUP BY ?player "+ " LIMIT 40";
le résultat :
le problème c'est quand j’exécute la même requête sous Virtuoso SPARQL Query Editor , elle marche bien !!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Non-group key variable in SELECT: ?nam at com.hp.hpl.jena.sparql.lang.SyntaxVarScope.checkExprVarUse(SyntaxVarScope.java:164) at com.hp.hpl.jena.sparql.lang.SyntaxVarScope.check(SyntaxVarScope.java:119) at com.hp.hpl.jena.sparql.lang.SyntaxVarScope.check(SyntaxVarScope.java:70) at com.hp.hpl.jena.sparql.lang.SPARQLParser.validateParsedQuery(SPARQLParser.java:56) at com.hp.hpl.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:54) at com.hp.hpl.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:37) at com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:148) at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:80) at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:53) at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:41) at itsudparis.application.Testquery.main(Testquery.java:91) Java Result: 1
svp qu'est ce je dois faire ? et merci
Partager