一个 SPARQL(有效)查询与另一个(无效)查询之间的区别

Difference between one SPARQL (working) query and another one (not working)

我想从此页面获取 scorers (marcatori):http://it.dbpedia.org/resource/Modena_Football_Club_1962-1963 使用此 SPARQL 端点:http://uriburner.com/sparql/

如果我使用这个查询:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT
  ?team
  ?club
  (group_concat(distinct ?scorer;separator=";;;") as ?scorers) 
WHERE {
SERVICE <http://it.dbpedia.org/sparql/> {
   ?value rdfs:label "Campionato italiano di calcio Serie A"@it .
   ?year <http://purl.org/dc/terms/subject> ?value . 
   ?team <http://dbpedia.org/ontology/league> ?year .
   ?team <http://it.dbpedia.org/property/club> ?club .
   OPTIONAL { ?team <http://it.dbpedia.org/property/marcatori> ?scorer 
   }
}

} 
GROUP BY ?team ?club 
ORDER BY ?club
LIMIT 1 

我没有得到任何结果,好像我使用了这个:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT
  ?team
  ?club
WHERE {
SERVICE <http://it.dbpedia.org/sparql/> {
   ?value rdfs:label "Campionato italiano di calcio Serie A"@it .
   ?year <http://purl.org/dc/terms/subject> ?value . 
   ?team <http://dbpedia.org/ontology/league> ?year .
   ?team <http://it.dbpedia.org/property/club> ?club 
}

} 
GROUP BY ?team ?club 
ORDER BY ?club
LIMIT 1 

我正确地得到:

{ "head": { "link": [], "vars": ["team", "club"] },
  "results": { "distinct": false, "ordered": true, "bindings": [
    { "team": { "type": "uri", "value": 
 "http://it.dbpedia.org/resource/Modena_Football_Club_1962-1963" }  , 
 "club": { "type": "uri", "value": 
 "http://it.dbpedia.org/resource/Modena_Football_Club" }} ] } }

有谁知道为什么第一个查询 returns 为空?

你可以替换

(group_concat(distinct ?scorer;separator=";;;") as ?scorers)

sql:group_concat(?scorer, ";;;") as ?scorers

这在 http://it.dbpedia.org/sparql 上应该可以正常工作,不确定为什么需要 URI 刻录机。