【发布时间】:2016-07-02 12:36:43
【问题描述】:
我正在尝试使用 sparql 搜索检索 dbpedia 的precedBy 和 followBy 属性的书名。 例如。 http://dbpedia.org/page/Harry_Potter_and_the_Goblet_of_Fire - 将返回前面和后面的书名的查询。因此,如果我输入书名“密室”,我会在归还之前和之后得到书籍。
我尝试观看了一些关于 sparql 的视频,并查看了https://km.aifb.kit.edu/projects/spartiqulator/examples.htm 此处的示例,但似乎无法生成有效的查询。
我尝试了以下方法,但它会产生语法错误。我不确定如何以正确的方式链接我尝试过滤的属性,例如 rdf: 和 dbp 等。
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX res: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?uri
WHERE {
?uri rdf:type dbo:Book .
?uri dbp:precededBy res:'Harry Potter and the Chamber of Secrets' .
}
以下运行但没有结果。
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX res: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?uri
WHERE {
?uri rdf:type dbo:Book .
?uri dbp:followedBy 'Harry Potter and the Order of the Phoenix' .
}
【问题讨论】:
-
请告诉我们,您已经尝试过什么
标签: dbpedia