如果我想在Appomattox Court House National Historical Park中查询DBPedia的RDF,如果我按维基页面网址搜索,那么查询字符串是什么?
我测试了以下字符串但没有结果:
select ?building
where {
?building a dbo:Building .
?building foaf:primaryTopic <http://en.wikipedia.org/wiki/Appomattox_Court_House_National_Historical_Park>
} LIMIT 100
答案 0 :(得分:1)
正如我在评论中所说:问题是你使用foaf:primaryTopic
关系是错误的。维基页面是关系的主题,DBPedia资源是对象值。所以它应该是这样的:
SELECT ?building
WHERE {
?building a dbo:Building .
<http://en.wikipedia.org/wiki/Appomattox_Court_House_National_Historical_Park> foaf:primaryTopic ?building .
}
LIMIT 100
或者,正如@AKSW评论的那样,您可以使用反向关系,称为foaf:isPrimaryTopicOf
:
SELECT ?building
WHERE {
?building a dbo:Building .
?building foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Appomattox_Court_House_National_Historical_Park> .
}
LIMIT 100