【发布时间】:2018-04-23 03:18:27
【问题描述】:
此 SPARQL 请求在 Wikidata 中查找所有名为“Berlin”的城市:
SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
?type (a | wdt:P279) wd:Q515. # Sub-type of city
?item wdt:P31 ?type.
?item rdfs:label "Berlin"@en.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
问题:它returns zero result。
同时,correctly findsQ64(德国首都和城邦)下面的请求,但它也返回了很多其他称为柏林的东西,所以我想过滤城市 (然后在未来阶段我将按人口对这些城市进行排序,但这超出了这个问题的范围):
SELECT DISTINCT ?item ?itemLabel ?itemDescription WHERE {
?item rdfs:label "Berlin"@en.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
注意:我获取城市子类实例的代码(柏林是 big city,它是 city 的子类)似乎可以正常工作,如 this query 的结果所示。
【问题讨论】: