如何查询给定维基百科URL的DBPedia数据? [英] How to query DBPedia data for a given Wikipedia URL?

查看:162
本文介绍了如何查询给定维基百科URL的DBPedia数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想在RDF中查询 Appomattox法院大楼国家历史公园 http://live.dbpedia.org/sparql rel = nofollow> DBPedia ,如果我通过Wiki页面URL搜索,查询字符串是什么?

If I want to query the RDF for Appomattox Court House National Historical Park in DBPedia, what's the query string if I search by wiki page URL?

我测试了以下字符串,但未得到结果:

I tested the following string but get no result:

select ?building 
where {
   ?building a dbo:Building .
   ?building foaf:primaryTopic <http://en.wikipedia.org/wiki/Appomattox_Court_House_National_Historical_Park>
} LIMIT 100


推荐答案

还要评论:问题是您使用 foaf:primaryTopic 关系是错误的方法。 Wiki页面是该关系的 subject ,而DBPedia资源则是对象值。因此应该是这样:

As said in my comment as well: the problem is that you are using the foaf:primaryTopic relation the wrong way around. The wiki page is the subject of the relation, and the DBPedia resource the object value. So it should be this:

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

Alternatively, as @AKSW commented, you can use the inverse relation, which is called 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

这篇关于如何查询给定维基百科URL的DBPedia数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆