我正在开发一个项目,我想使用DBpedia。我有几百个DBpedia链接,如
更好地利用时间:
答案 0 :(得分:6)
首先,请注意标识DBpedia资源的URI不是
使用页面,但
使用资源。其次,使用SPARQL检索信息会更快 。 SPARQL是RDF的查询语言,您希望获得RDF数据。您需要在SPARQL中获取有关FEMA的信息,这是一个描述查询:
describe
dbpedia:Federal_Emergency_Management_Agency
描述查询可以描述多个资源,因此您可以这样做,例如:
describe
dbpedia:Federal_Emergency_Management_Agency
dbpedia:Mount_Monadnock
# more resources...
如果您只想了解某些资源的某些信息,您仍然可以使用values
以及以编程方式注入您感兴趣的资源来选择或构建查询;
select ?label where {
values ?resource {
dbpedia:Federal_Emergency_Management_Agency # put your values in here and
dbpedia:Mount_Monadnock # ?resource will be bound to each
}
?resource rdfs:label ?label .
filter( langMatches( lang(?label), "EN" ))
}
您还可以使用构造在模型中获取这些三元组:
construct {
?resource rdfs:label ?label
}
where {
values ?resource {
dbpedia:Federal_Emergency_Management_Agency
dbpedia:Mount_Monadnock
}
?resource rdfs:label ?label .
filter( langMatches( lang(?label), "EN" ))
}