问题描述
我正在尝试提取此dbpedia页面 http://dbpedia.org/page/Diageo
的制造商部分。但是我的SPARQL查询什么也不返回。但是我可以返回页面上的其他大多数值,例如布局完全相同的keyPersons。
I am trying to extract the manufacturer section of this dbpedia page http://dbpedia.org/page/Diageo
. However my SPARQL query returns nothing. Yet I can return most other values on the page, such as keyPersons which has the exact same layout.
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?label
WHERE { <http://dbpedia.org/resource/Diageo>
dbpedia-owl:keyPerson ?label }
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?label
WHERE { <http://dbpedia.org/resource/Diageo>
dbpedia-owl:manufacturer ?label }
有什么想法吗?
推荐答案
在DBpedia中,实体页面显示的语句中,实体不仅可以是主体,而且可以是对象。在后一种情况下,相应的属性显示为 是...的。
In DBpedia, an entity page displays statements in which an entity may be not only a subject, but also an object. In the latter case, respective property appears as "is ... of".
相反,您链接的表示 dbr:Diageo
是 dbo:manufacturer
of > dbr:Johnnie_Walker
等。这意味着 dbr:Johnnie_Walker dbo:manufacturer dbr:Diageo
成立,而不是 dbr:Diageo dbo:manufacturer dbr:Johnnie_Walker
确实。
Conversely, the page you have linked to says that dbr:Diageo
is dbo:manufacturer
of dbr:Johnnie_Walker
etc. This means that dbr:Johnnie_Walker dbo:manufacturer dbr:Diageo
holds, not that dbr:Diageo dbo:manufacturer dbr:Johnnie_Walker
does.
顺便说一下, rdfs:range 的
dbo:manufacturer
dbo:Organization
。
因此,您应该寻找与反向模式匹配的三元组:
Thus, you should looking for triples that match reversed pattern:
SELECT * WHERE { ?variable dbo:manufacturer ?dbr:Diageo . }
或者,使用:
SELECT * WHERE { dbr:Diageo ^dbo:manufacturer ?variable . }
这篇关于通过DBO查询Dbpedia-SPARQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!