Sparql 如何使用Jena查询/更新远程RDF端点
我想通过http向远程端点发送更新。 我发现joseki就是这样一个端点 但是,如果我只知道端点的uri,如何向该端点发送更新查询Sparql 如何使用Jena查询/更新远程RDF端点,sparql,jena,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 sett
// 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的端点执行远程更新查询
更新:
最后求助于当地人。这种RDF端点接受insert和delete语句。
我没有成功地找到可以接受修改查询的远程RDF端点
否则我想听听怎么做
对端点执行远程更新查询
只有URI是已知的
根据端点服务器的不同,处理方式略有不同。有一份议定书草案。但由于它是草案和相当新的支持是一个小变种
一般来说,您可以编写sparql更新查询,就像编写SQL insert或update语句一样
更新命令有Modify、Insert、Delete、Load、Clear,但并非每个imlpement都支持所有这些命令
由于端点通常是公共的,因此在允许操作之前通常需要进行一些身份验证,这在规范中没有定义,因此是特定于实现的
建议对update语句使用不同的URL,以便使用http身份验证。4store,使用/sparql进行查询,使用/update进行更新查询
W3C草案提供了一些如何构造sparql更新查询的方法。Joseki不支持远程更新。您可能应该看看它的后续版本,它支持SPARQL更新