【问题标题】:How do I query/update a remote RDF-endpoint with Jena如何使用 Jena 查询/更新远程 RDF 端点
【发布时间】:2010-08-16 12:50:19
【问题描述】:

我想通过 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 端点。

【问题讨论】:

    标签: sparql jena


    【解决方案1】:

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

    这取决于端点服务器的处理方式略有不同。有一个草案sparql/update 协议。但由于它是草稿,而且相当新的支持有点不同。

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

    更新命令是修改、插入、删除、加载、清除,但并非每个实施都支持所有这些。

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

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

    W3C 草案中有一些关于如何构建 sparql 更新查询的examples

    【讨论】:

      【解决方案2】:

      Joseki 不支持远程更新。您可能应该看看它的继任者 Fuseki,它支持 SPARQL 更新。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多