使用DBpedia进行图书搜索

时间:2011-01-18 10:44:35

标签: sparql dbpedia

我想编写代码来查询DBpedia并搜索书籍信息,如作者,书名等。

我应该使用什么前缀和命名图来构建此SPARQL查询?

1 个答案:

答案 0 :(得分:4)

示例查询可能如下所示:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX ontology: <http://dbpedia.org/ontology/>

select distinct ?s  ?author 
where {
?s rdf:type ontology:Book;
  ontology:author ?author .
}

您可以在http://dbpedia.org/sparql上进行测试 默认图表为http://dbpedia.org

您可能还需要查看http://mappings.dbpedia.org/server/ontology/classes/Book的图书类属性