我正在DBpedia上运行一个查询,我收到了一些结果,这些结果显然是编码错误和字符出现的问号,例如--
http://dbpedia.org/resource/Bo?aziçi_University-我希望看到的地方--
http://dbpedia.org/resource/Bo%C4%9Fazi%C3%A7i_University这里你可以找到真正的标题。
您可以在http://live.dbpedia.org/sparql执行我的查询
PREFIX yago: <http://dbpedia.org/class/yago/>
PREFIX schema: <http://schema.org/>
PREFIX dbpedia: <http://dbpedia.org/>
SELECT ?school
WHERE
{
{ ?school rdf:type schema:EducationalOrganization . }
UNION
{ ?school rdf:type yago:EducationalInstitution108276342 . }
UNION
{ ?school rdf:type yago:College108278169 . }
UNION
{ ?school dbpedia:type dbr:Public_university . }
}我做错了什么吗?为了得到正确的结果,我必须对我的查询做任何补充吗?是否与数据相关(基本上数据是错误的,所以什么都做不了)?
发布于 2016-04-07 14:29:03
我不认为你做错了什么。我认为,您看到的结果与Boğazi i大学相同,结果也显示在结果中。可能只是数据中的一些噪音。如果你要求实体的名字中有一个文字问号,你会看到一堆。下面是您的查询的简化版本(不使用union),它只包括在URI中包含有的实体:
SELECT DISTINCT ?school WHERE
{
values ?type { schema:EducationalOrganization
yago:EducationalInstitution108276342
yago:College108278169
dbr:Public_university }
values ?hasType { rdf:type dbpedia:type }
?school ?hasType ?type .
filter(contains(str(?school), "?"))
}SPARQL结果
您可以反转该过滤器并简单地排除那些结果,我认为您最终会得到您想要的结果:
SELECT DISTINCT ?school WHERE
{
values ?type { schema:EducationalOrganization
yago:EducationalInstitution108276342
yago:College108278169
dbr:Public_university }
values ?hasType { rdf:type dbpedia:type }
?school ?hasType ?type .
filter(!contains(str(?school), "?"))
}SPARQL结果
https://stackoverflow.com/questions/36477641
复制相似问题