Sparql sesame2和jena的结果数量不同

Sparql sesame2和jena的结果数量不同,sparql,jena,sesame,Sparql,Jena,Sesame,我正在写一些在jena和sesame2上运行的查询。除了我指定路径的深度外,它们中的大多数都在sesame2下正常工作。例如,如果我在sesame下运行这个查询,它会给出8个结果,而jena会给出217个(正确的数字) 应该有2个结果,而不是1个 我还应该补充一点,当我不使用属性路径(即我使用+而不是{1,3})时,它会给出正确的结果数。您使用的路径长度上下限({1,3})的结构不再是官方支持的SPARQL功能,在最近的一次更新中,它已从SPARQL规范中删除 Sesame的SPARQL查询解析

我正在写一些在jena和sesame2上运行的查询。除了我指定路径的深度外,它们中的大多数都在sesame2下正常工作。例如,如果我在sesame下运行这个查询,它会给出8个结果,而jena会给出217个(正确的数字)

应该有2个结果,而不是1个


我还应该补充一点,当我不使用属性路径(即我使用+而不是{1,3})时,它会给出正确的结果数。

您使用的路径长度上下限(
{1,3}
)的结构不再是官方支持的SPARQL功能,在最近的一次更新中,它已从SPARQL规范中删除


Sesame的SPARQL查询解析器仍然接受这种构造。我在Sesame2.7.0-beta1上测试了您的查询,您是正确的,它不会产生预期的答案(而使用
+
,这仍然是SPARQL的官方功能,确实可以正常工作)。这是Sesame查询解析器中的一个bug。然而,考虑到
{1,3}
构造不再是SPARQL的正式部分,我不确定它是否会被修复——更可能的是,在下一个Sesame版本中,该构造将导致语法错误

芝麻人可能会喜欢一个完整的、最少的例子。完成=>一些数据和预期结果;minimal=>不大于必需的值(不是217个结果,尽可能简单的查询)。此外,请告诉我们您使用的是哪个版本的Sesame。属性路径是一项新功能。SPARQL规范中的官方定义和Sesame中的实现在不同版本中都发生了多次更改。从SPARQL 1.1的最新版本开始,实现
prop{1,3}
,AFAIK的唯一方法是类似
prop |(prop/prop)|(prop/prop/prop/prop)
的表达式。诚然,这并不能很好地扩展到更长的路径。@sdesciencelover我尝试使用prop |(prop/prop)|(prop/prop/prop),不幸的是,我又得到了1个结果……尽管它对jena有效。我期待的结果是:开始达到开始达到这里有一个有趣的注意事项(也许我应该创建一个新的问题?)如果我使用道具,那么我会得到1->5作为预期,但如果我使用道具/道具/道具,我也会得到1->5(不要期待任何,道具/道具应该是1->0)
PREFIX edge: <http://danielfrentz.com/edge#> 
PREFIX property: <http://danielfrentz.com/property#> 
select  distinct ?start ?reached where{ 
?start property:id \"v1\". 
?start (edge:uses | edge:implements | edge:extends)+ ?reached.
filter(?start != ?reached)}
@prefix edge: <http://danielfrentz.com/edge#>.
@prefix edge: <http://danielfrentz.com/property#>.
<http://danielfrentz.com/v2> <http://danielfrentz.com/property#name> "Class3".
<http://danielfrentz.com/v2> <http://danielfrentz.com/property#abstract> "false".
<http://danielfrentz.com/v2> <http://danielfrentz.com/property#type> "class".
<http://danielfrentz.com/v2> <http://danielfrentz.com/property#namespace>    "com.example".
<http://danielfrentz.com/v2> <http://danielfrentz.com/property#id> "v2".
<http://danielfrentz.com/v1> <http://danielfrentz.com/property#name> "Class2".
<http://danielfrentz.com/v1> <http://danielfrentz.com/property#abstract> "false".
<http://danielfrentz.com/v1> <http://danielfrentz.com/property#type> "class".
<http://danielfrentz.com/v1> <http://danielfrentz.com/property#namespace>      "com.example".
<http://danielfrentz.com/v1> <http://danielfrentz.com/property#id> "v1".
<http://danielfrentz.com/v3> <http://danielfrentz.com/property#name> "Class4".
<http://danielfrentz.com/v3> <http://danielfrentz.com/property#abstract> "false".
<http://danielfrentz.com/v3> <http://danielfrentz.com/property#type> "class".
<http://danielfrentz.com/v3> <http://danielfrentz.com/property#namespace> "com.example".
<http://danielfrentz.com/v3> <http://danielfrentz.com/property#id> "v3".
<http://danielfrentz.com/v4> <http://danielfrentz.com/property#name> "AbstractClass1".
<http://danielfrentz.com/v4> <http://danielfrentz.com/property#abstract> "true".
<http://danielfrentz.com/v4> <http://danielfrentz.com/property#type> "class".
<http://danielfrentz.com/v4> <http://danielfrentz.com/property#namespace>   "com.example".
<http://danielfrentz.com/v4> <http://danielfrentz.com/property#id> "v4".
<http://danielfrentz.com/v0> <http://danielfrentz.com/property#name> "Class1".
<http://danielfrentz.com/v0> <http://danielfrentz.com/property#abstract> "false".
<http://danielfrentz.com/v0> <http://danielfrentz.com/property#type> "class".
<http://danielfrentz.com/v0> <http://danielfrentz.com/property#namespace>  "com.example".
<http://danielfrentz.com/v0> <http://danielfrentz.com/property#id> "v0".
<http://danielfrentz.com/v5> <http://danielfrentz.com/property#name> "Interface1".
<http://danielfrentz.com/v5> <http://danielfrentz.com/property#abstract> "true".
<http://danielfrentz.com/v5> <http://danielfrentz.com/property#type> "interface".
<http://danielfrentz.com/v5> <http://danielfrentz.com/property#namespace>    "com.example".
<http://danielfrentz.com/v5> <http://danielfrentz.com/property#id> "v5".
<http://danielfrentz.com/v3> <http://danielfrentz.com/edge#extends>     <http://danielfrentz.com/v4>.
<http://danielfrentz.com/v2> <http://danielfrentz.com/edge#uses>    <http://danielfrentz.com/v3>.
<http://danielfrentz.com/v4> <http://danielfrentz.com/edge#uses> <http://danielfrentz.com/v2>.
<http://danielfrentz.com/v5> <http://danielfrentz.com/edge#uses> <http://danielfrentz.com/v0>.
<http://danielfrentz.com/v1> <http://danielfrentz.com/edge#implements> <http://danielfrentz.com/v5>.
<http://danielfrentz.com/v0> <http://danielfrentz.com/edge#uses> <http://danielfrentz.com/v1>.
PREFIX edge: <http://danielfrentz.com/edge#>
PREFIX property: <http://danielfrentz.com/property#>
select  distinct ?start ?reached where{
?start property:id \"v1\". 
?start (edge:uses | edge:implements | edge:extends){1,3} ?reached.
FILTER (?start != ?reached)}
start start=http://danielfrentz.com/v1
reached reached=http://danielfrentz.com/v5