我在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 . }
}
难道我做错了什么?我是否需要对查询进行任何补充才能获得正确的结果?它与数据相关吗(基本上是错误的数据,所以无能为力)?
我认为您没有做错任何事情。我认为您看到的结果与BoğaziçiUniversity相同,后者也显示在结果中。可能只是数据中有些杂音。如果您要求名称中带有文字问号的实体,则会看到一堆。这是查询的简化版本(不使用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), "?"))
}
您可以反转该过滤器,而只是排除那些结果,我想您最终会得到想要的结果:
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), "?"))
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句