【发布时间】:2020-10-08 08:06:20
【问题描述】:
Ontotext GraphDB 或 RDF4J SPARQL 评估中的 BOUND() 函数似乎存在问题。后者不太可能,因为我无法使用内存中的 SAIL 重现该错误。
版本:Graphdb Free 9.4.1(以及一些更早的版本:在 9.4.0 中确认,在 9.3.3 中怀疑,也可能比这更早)。
复制:
- 在 Windows 10 下安装新的 9.4.1 免费 GraphDB
- 使用默认配置创建存储库,除了:启用SHACL验证,没有推理(没有系统地测试其他配置,我怀疑都受到影响)
将下面的测试数据导入到默认图表中:
@prefix ex: <http:example.com/vocab#> .
@prefix : <http:example.com/test#> .
:buildingA a ex:Building ;
ex:height 100;
ex:floors 30 .
:buildingB a ex:Building ;
ex:height 80 .
执行这个查询:
select ?type (bound(?type) as ?test)
where {
?s a ?type .
}
结果:
?type ?test
<http:example.com/vocab#Building> "false"^^<http://www.w3.org/2001/XMLSchema#boolean>
<http:example.com/vocab#Building> "false"^^<http://www.w3.org/2001/XMLSchema#boolean>
显然,?test 在这两种解决方案中都应该为真。
我尝试了 sparql 查询的多种变体,例如在 where 子句中绑定 ?test 并使用图形模式 - 结果总是相同的。
如果有解决此问题的方法,我将不胜感激。
【问题讨论】:
-
有一个解决方案,但它并没有在 9.4.1 中结束。最简单的解决方法是在投影中引入任意未使用的 var,例如
select ?type (bound(?type) as ?test) ?fictive_var where { ... -
谢谢,这对我有用!如果您将其发布为答案,我会接受它