一个SPARQL(有效)查询与另一个(无效)查询之间的区别 [英] Difference between one SPARQL (working) query and another one (not working)

查看:70
本文介绍了一个SPARQL(有效)查询与另一个(无效)查询之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从以下页面获取得分手 marcatori ): http: ///。it.dbpedia.org/resource/Modena_Football_Club_1962-1963 使用以下SPARQL端点: http://uriburner.com/sparql/

I want to get the scorers (marcatori) from this page: http://it.dbpedia.org/resource/Modena_Football_Club_1962-1963 using this SPARQL endpoint: 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 

我没有得到任何结果,就像我使用该结果一样:

I get no results, where as if I use this one:

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" }} ] } }

有人知道为什么第一个查询返回空吗?

Does anyone know why the first query returns empty?

推荐答案

您可以替换

(group_concat(distinct?scorer; separator = ;;;)作为?scorers)

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

http://it.dbpedia.org/sparql ,不确定为什么需要URI刻录机。

This should work fine on http://it.dbpedia.org/sparql, not sure why you need URI burner.

这篇关于一个SPARQL(有效)查询与另一个(无效)查询之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆