SPARQL-按类别字符串检索DBPedia资源 [英] SPARQL- Retrieving a DBPedia resource by category string
问题描述
如何获取基于Wikipedia类别的DBpedia资源?举例来说,
淹没了日本所有的岛屿。
与洪水相关的候选类别的清单包括:
How can I obtain DBpedia resources based on a Wikipedia category? For example, all Japan's islands that have been flooded. A list of possible categories candidates related to "Flood" include:
- 类别:Floods_in_Malaysia
- 类别:Floods_in_Singapore
- 类别:Floods_in_Japan,
- 和其他许多人……
- Category:Floods_in_Malaysia
- Category:Floods_in_Singapore
- Category:Floods_in_Japan,
- and many others…
我无法使用SPARQL查询从类别浏览到某些资源。
I couldn't navigate using SPARQL queries from categories to certain resources.
推荐答案
其中之一找出针对DBpedia编写的SPARQL查询的最简单方法是找到包含所需信息的Wikipedia,然后检查与其对应的DBpedia资源,然后基于该资源构造查询。例如,有一篇Wikipedia文章 1993年鹿儿岛大雨。根据命名约定,这使我们转到DBpedia资源 http://dbpedia.org/resource/1993_Kagoshima_Heavy_Rain。浏览此内容,我们可以看到该文章与日本洪水类别有何关系。特别是,我们看到数据包含以下三元组:
One of the easiest ways to figure out what SPARQL query to write against DBpedia is to find a Wikipedia with some of the information that you want, then examine the DBpedia resource corresponding to it, and then constructing the query based on that. For instance, there is a Wikipedia article, 1993 Kagoshima Heavy Rain. Based on the naming convention, this leads us to the DBpedia resource http://dbpedia.org/resource/1993_Kagoshima_Heavy_Rain. Browsing this, we can see how the article is related to the category Floods in Japan. Particularly, we see that the data contains the following triple:
dbpedia:1993_Kagoshima_Heavy_Rain dcterms:subject category:Floods_in_Japan
这表明我们尝试将以下查询放入 DBpedia SPARQL端点:
This suggests that we try putting the following query into the DBpedia SPARQL Endpoint:
SELECT * WHERE {
?event dcterms:subject category:Floods_in_Japan .
}
有两个结果:
event
http://dbpedia.org/resource/1953_North_Kyushu_Flood
http://dbpedia.org/resource/1993_Kagoshima_Heavy_Rain
要回答您的特定问题,您必须对数据进行更多的挖掘以找到属性和资源所需,但您将遵循相同的一般流程。
To answer your particular question, you'll have to dig a bit more into the data to find the properties and resources that you need, but you'll follow the same general process.
这篇关于SPARQL-按类别字符串检索DBPedia资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!