[英]SPARQL query does not give all the results that are on dbpedia
我在http://dbpedia.org/snorql/中执行此查询:
查询:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/property/>
SELECT ?country_name ?population
WHERE {
?country a type:LandlockedCountries ;
rdfs:label ?country_name ;
prop:populationEstimate ?population .
}
查询查找所有土地查找国家。
我不明白为什么在结果中没有一些国家归入“/dbpedia.org/class/yago/LandlockedCountries”。 例如,巴拉圭(/dbpedia.org/page/ParaguAy)已分类,但未出现在查询结果集中。 有人可以解释一下为什么吗?
不幸的是,有少数内陆国家没有至少一个country_name
和populationEstimate
属性的值。 这就是为什么它们不会在您的查询中返回。 如果运行以下查询,则会出现这些国家/地区(这两个属性设置为OPTIONAL
)。
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX type: <http://dbpedia.org/class/yago/>
PREFIX prop: <http://dbpedia.org/property/>
SELECT ?country ?country_name ?population
WHERE {
?country a type:LandlockedCountries .
OPTIONAL {?country rdfs:label ?country_name Filter(lang(?country_name) = 'en')} .
OPTIONAL {?country prop:populationEstimate ?population} .
}
对于(稍微)更好的结果,由于一些国家似乎与错误的大写重复(例如ParaguAy和Paraguay ),以下查询使用?country dcterms:subject category:Landlocked_countries
而不是yago类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.