我用芝麻三叉戟存储我的数据。当我尝试使用带有外部资源(如dbpedia )的Sesame查询接口时,不会得到任何结果。在添加了所有必要的前缀后,此查询返回snorql的结果,但不返回Sesame:
select ?routes where {
dbpedia:Polio_vaccine dbpprop:routesOfAdministration ?routes
}我需要改变什么?
发布于 2015-05-28 07:08:54
您可以通过编程或通过Sesame以各种方式使用Sesame查询任何SPARQL端点,包括DBPedia。
使用工作台
使用Sesame工具,您可以通过为该端点创建存储库代理来查询DBPedia (或任何公共SPARQL端点),如下所示:

http://dbpedia.org/sparql。
设置好之后,您可以从“查询”菜单中查询它:

结果:

程序存取
您可以简单地创建一个连接到SPARQLRepository端点的DBPedia对象:
Repository repo = new SPARQLRepository("http://dbpedia.org/sparql");
repo.initialize();一旦有了它,您就可以使用它来执行SPARQL查询,就像在任何其他Sesame存储库上一样:
RepositoryConnection conn = repo.getConnection();
try {
StringBuilder qb = new StringBuilder();
qb.append("PREFIX dbpedia: <http://dbpedia.org/resource/> \n");
qb.append("PREFIX dbpprop: <http://dbpedia.org/property/> \n");
qb.append("SELECT ?routes \n");
qb.append("WHERE { dbpedia:Polio_vaccine dbpprop:routesOfAdministration ?routes } \n");
TupleQueryResult result =
conn.prepareTupleQuery(QueryLanguage.SPARQL, qb.toString()).evaluate();
while(result.hasNext()) {
BindingSet bs = result.next();
Value route = bs.getValue("routes");
System.out.println("route = " + route.stringValue());
}
}
finally {
conn.close();
}https://stackoverflow.com/questions/30495427
复制相似问题