如何使用Jena查询/更新远程RDF端点

时间:2010-08-16 12:50:19

标签: sparql jena

我想通过http向远程端点发送更新。 我发现joseki就是这样一个终点。

但是,如果我只知道端点的uri,如何向此端点发送更新查询?

// To do a select-query you can use this:
QueryExecution qe = QueryExecutionFactory.sparqlService(serviceURI, query);

// (Sidenote:) does the next line have the desired effect of setting the binding?
// After all, sparqlService has no alternative with initialBindang as parameter
qe.setInitialBinding(initialBinding);

result = qe.execSelect();

// But updates do not support this kind of sparqlService method
// Illegal:
// UpdateAction.sparqlServiceExecute(serviceURI, query);
// I can use the following:
UpdateAction.parseExecute(updateQuery, dataset, initialBinding);
// But dataset is a Dataset object, not the uri.

// I don't believe this is the correct way to overcome this:
Dataset dataset = DatasetFactory.create(serviceURI);

否则,我想听听如何对只知道URI的端点进行远程更新查询。

更新 最后到了当地jena。这种RDF端点接受插入和删除语句。 我没有成功找到一个可以接受修改查询的远程RDF端点。

2 个答案:

答案 0 :(得分:1)

  

否则我想听听怎么做   对端点进行远程更新查询   只知道URI。

根据端点服务器的不同,处理方式略有不同。有sparql/update草案协议。但由于它是草案,相当新的支持是一个小变体。

通常,您可以编写sparql更新查询,就像编写SQL插入或更新语句一样。

更新命令是修改,插入,删除,加载,清除,但不是每个imlpementation都支持所有这些。

由于端点通常是公共的,因此在允许操作之前通常需要进行一些身份验证,这在规范中没有定义,因此是特定于实现的。

建议将不同的URL用于更新语句,以便可以使用http身份验证。 4store,使用/ sparql查询和/更新更新查询。

W3C草案有一些examples如何构建sparql更新查询。

答案 1 :(得分:1)

Joseki不支持远程更新。您可能应该查看其后续版本Fuseki,它支持SPARQL更新。

相关问题