本文介绍了Sparql-删除查询在更新后停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个与openrdf芝麻和owlim模块一起使用的应用程序.最近,我需要将许可证密钥更新为owlim(我收到了最新的owlim版本的密钥),因此我也不得不更新芝麻.

I've created an application, which works with openrdf sesame and owlim module. Recently, I needed to update licence key to owlim (I received a key for the newest owlim version), so I was forced to update sesame as well.

应用程序是使用芝麻2.6.0和owlim 4.3构建的,现在已更新为芝麻2.6.8和owlim 5.2

Application was build with sesame 2.6.0 and owlim 4.3, now updated to sesame 2.6.8 and owlim 5.2

delete sparql查询存在问题,该问题在较旧的版本中有效,所以我直觉,这是问题所在.

There are issues with delete sparql queries, which works in older version, so I got a hunch, that update is the problem.

这是一个这样的查询:

PREFIX oporg: <http://sesame.company.org/OPropertiesOrg#>

WITH <users:>
DELETE {
?userID oporg:sessionID ?sessionID
}
INSERT {
?userID oporg:sessionID "qafnsi9p1172c0dprf9e4bhm23"
}
WHERE{
?userID oporg:name "admin"
}

这应该(根据我的记忆:)用userID=admin删除每个sessionID三元组并插入新的sessionID三元组.

this should (according what I remember :) delete every sessionID triplet with userID=admin and insert new sessionID triplet.

插入部分有效,但删除部分无效.

Insert part works, but delete part doesn't.

推荐答案

此方法不再起作用的原因是,您的DELETE子句包含一个变量(?sessionID),该变量从未绑定到任何地方的值,因此在对...求值时操作,这将转换为不完整的三重模式,并且将被忽略.

The reason this no longer works is that your DELETE clause contains a variable (?sessionID) that is never bound to a value anywhere, so during the evaluation of the operation, this translates to an incomplete triple pattern and is ignored.

在早期版本的Sesame中,DELETE子句中的未绑定变量被解释为表示通配符.但是,这与SPARQL规范冲突,因此已作为Sesame 2.6.7版中的错误修复.参见 http://www.openrdf.org/issues/browse/SES-1047了解详情.

In earlier versions of Sesame, an unbound variable in the DELETE clause was interpreted to mean a wildcard. However, this is in conflict with the SPARQL specification, and was therefore fixed as a bug in Sesame release 2.6.7. See http://www.openrdf.org/issues/browse/SES-1047 for details.

您应该通过在WHERE子句中添加?sessionID模式来对DELETE操作进行一些修改,如下所示:

You should modify your DELETE operation slightly, by adding the ?sessionID patern to your WHERE-clause, like so:

PREFIX oporg: <http://sesame.company.org/OPropertiesOrg#>

WITH <users:>
DELETE {
   ?userID oporg:sessionID ?sessionID
}
INSERT {
   ?userID oporg:sessionID "qafnsi9p1172c0dprf9e4bhm23"
}
WHERE{
   ?userID oporg:name "admin" ;
           oporg:sessionID ?sessionID .
}

这篇关于Sparql-删除查询在更新后停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:44
查看更多