Different number of results with sesame2 and jena

I am writing several queries that run for both jena and sesame2. Most of them work correctly under sesame2, except when I specify the path depth. For example, if I run this query under sesame, it gives me 8 results, whereas jena gives 217 (correct number).

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)}

      

So my question is, does sesame2 have a different definition of path depth syntax? or is there another reason why I might get different results?

Thank.

Additional Information:

I am using 2.6.10 and testing 2.7 beta.

The smallest approximate graph I have is the following (sorry it takes so long):

@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>.

      

Request:

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)}

      

and the results:

start start=http://danielfrentz.com/v1
reached reached=http://danielfrentz.com/v5

      

there must be 2 results not 1.

I should also add that when I do not use the property path (ie I use + instead of {1,3}) it gives the correct number of results.

+3


source to share


1 answer


The construct you are using with lower and upper bounds on path length ( {1,3}

) is no longer an officially supported SPARQL function, it was removed from the SPARQL specification in a recent update.



The Sesame SPARQL parser still accepts the construct. I tested your query against Sesame 2.7.0-beta1 and you are correct, it does not give the expected response (whereas the usage +

, which is still an official SPARQL feature, works correctly). So this is a bug in the Sesame query parser. However, given that the construct is {1, 3}

no longer officially part of SPARQL, I'm not sure if it will be fixed - most likely, in the next version of Sesame, the construct will result in a syntax error.

0


source







All Articles