[ 
https://issues.apache.org/jira/browse/JENA-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15309050#comment-15309050
 ] 

Eetu Mäkelä commented on JENA-1187:
-----------------------------------

Okay, so the answer to my primary question seems to be that I was relying on a 
bug, where the actual linear order that the query was being run by leaked out 
instead of staying inside the pure bottom-up SPARQL algebra interpretation. 
(Fixing which is a bit of a shame for me, because it was really useful to be 
able to use unioned blocks just as alternates 'inside' a graph pattern, and now 
I'll be forced to copy a lot of VALUES and binds and filters to each of parts 
of the unions.)

There's still something funny going on though too, as based on the generative 
interpretation, shouldn't
{noformat}
 SELECT  *
  WHERE
    { { BIND("nonexistant" AS ?cl)
          { BIND(?cl AS ?cl2)
            ?c  a  ?cl 
          }
        UNION
          { BIND(?cl AS ?cl2)
            ?c  a ?cl2
          }
      }
    }
{noformat}
still produce all rdf:type statements inside a dataset from the second part of 
the union? Because it doesn't, but results in an empty result set (where your 
reduced example or my other example does produce them).

> Wrong results/performance regression when using BIND and graph pattern groups
> -----------------------------------------------------------------------------
>
>                 Key: JENA-1187
>                 URL: https://issues.apache.org/jira/browse/JENA-1187
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 3.1.0, Fuseki 2.4.0
>            Reporter: Eetu Mäkelä
>
> I've been using SPARQL queries with BINDs and/or VALUESs that precede UNION 
> blocks. These used to work efficiently (at least in Jena 2 times) with the 
> bound value being bound also in the subpattern, but no longer do. In 
> addition, at certain times, they produce nonsensical results. For example, 
> the below returns {{rdf:type}} statements in the dataset without any regard 
> to ?cl:
> {code}
> SELECT * {
>   {
>     BIND("nonexistant" AS ?cl)
>     {
>       BIND(?cl AS ?cl2)
>       ?c a ?cl2 .
>     } UNION {
>       BIND(?cl AS ?cl2)
>       ?c a ?cl2 .
>     }
>   }
> }
> LIMIT 10
> {code}
> while if you change _just one_ of the subpatterns in the union to directly 
> refer to ?cl, it returns an empty result set:
> {code}
> SELECT * {
>   {
>     BIND("nonexistant" AS ?cl)
>     {
>       BIND(?cl AS ?cl2)
>       ?c a ?cl .
>     } UNION {
>       BIND(?cl AS ?cl2)
>       ?c a ?cl2 .
>     }
>   }
> }
> LIMIT 10
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to