Subqueries sharing variables with outer

Hi,

With 5 Triples stores I'm getting 3 different results for the following query:
 
select ?x ?y where {
   values ?x { 1 2 }
   OPTIONAL {
      select ?y where {
          {
              values ?y { 5 6  }
          }  UNION {
              bind (?x as ?y)
          }
      }
  }
}

According to the spec subqueries are evaluated logically first [1], however I noticed implementations behaving differently and a conversation [2] on this list in June 2016 questioning this requirement.


>From RDF4J persistent store (in a  FluidOps information workbench) I get the following answer:
+---+---+
| x | y |
+---+---+
| 1 | 5 |
| 1 | 6 |
| 1 | 1 |
| 2 | 5 |
| 2 | 6 |
| 2 | 2 |
+---+---+

>From Fuseki, GraphDB and StarDog I get the following answer:
+---+---+
| x | y |
+---+---+
| 1 | 5 |
| 1 | 6 |
| 1 |    |
| 2 | 5 |
| 2 | 6 |
| 2 |    |
+---+---+

>From virtuoso store (htttp://dbpedia.org/sparql) I get the following answer:
| x | y |
+---+---+
| 1 |   |
| 2 |   |
+---+---+

I assume that the majority is right with the second result. Is this assumption correct?

Cheers,
Reto 




1. https://www.w3.org/TR/sparql11-query/#subqueries 
2. https://lists.w3.org/Archives/Public/public-sparql-dev/2016AprJun/0026.html

Received on Thursday, 13 September 2018 12:42:57 UTC