You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Joshua Taylor (JIRA)" <ji...@apache.org> on 2014/02/03 19:14:09 UTC

[jira] [Updated] (JENA-633) subqueries with limits project more results than they should

     [ https://issues.apache.org/jira/browse/JENA-633?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joshua Taylor updated JENA-633:
-------------------------------

    Description: 
A subquery with `limit 1` specified can `leak` more values to the surrounding query.  Rob Vesse tracked this down to a difference between the basic algebra and the optimized algebra [1] .  One query has the following basic and optimized Ops;  the "join" in the former shouldn't get turned into a "sequence"  in the latter.

{noformat}
Basic:
(join
  (bgp (triple ?resource <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ex:Thing>))
  (slice _ 1
    (project (?resource ?p)
      (order (?p)
        (bgp (triple ?resource <urn:ex:p> ?p))))))

Optimized:
(sequence
  (bgp (triple ?resource <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ex:Thing>))
  (project (?resource ?p)
    (top (1 ?p)
      (bgp (triple ?resource <urn:ex:p> ?p)))))
{noformat}

[1] http://answers.semanticweb.com/questions/26343/outer-query-results-include-more-values-than-subquery-with-limit-n-produces/26344

  was:
A subquery with `limit 1` specified can `leak` more values to the surrounding query.  Rob Vesse tracked this down to a difference between the basic algebra and the optimized algebra [1] .  One query has the following basic and optimized Ops;  the "join" in the former shouldn't get turned into a "sequence"  in the latter.

Basic:
(join
  (bgp (triple ?resource <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ex:Thing>))
  (slice _ 1
    (project (?resource ?p)
      (order (?p)
        (bgp (triple ?resource <urn:ex:p> ?p))))))

Optimized:
(sequence
  (bgp (triple ?resource <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ex:Thing>))
  (project (?resource ?p)
    (top (1 ?p)
      (bgp (triple ?resource <urn:ex:p> ?p)))))

[1] http://answers.semanticweb.com/questions/26343/outer-query-results-include-more-values-than-subquery-with-limit-n-produces/26344


> subqueries with limits project more results than they should
> ------------------------------------------------------------
>
>                 Key: JENA-633
>                 URL: https://issues.apache.org/jira/browse/JENA-633
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ, Jena
>    Affects Versions: Jena 2.11.0
>            Reporter: Joshua Taylor
>              Labels: optimization, sparql
>         Attachments: SubqueryLimitBug.java
>
>
> A subquery with `limit 1` specified can `leak` more values to the surrounding query.  Rob Vesse tracked this down to a difference between the basic algebra and the optimized algebra [1] .  One query has the following basic and optimized Ops;  the "join" in the former shouldn't get turned into a "sequence"  in the latter.
> {noformat}
> Basic:
> (join
>   (bgp (triple ?resource <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ex:Thing>))
>   (slice _ 1
>     (project (?resource ?p)
>       (order (?p)
>         (bgp (triple ?resource <urn:ex:p> ?p))))))
> Optimized:
> (sequence
>   (bgp (triple ?resource <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:ex:Thing>))
>   (project (?resource ?p)
>     (top (1 ?p)
>       (bgp (triple ?resource <urn:ex:p> ?p)))))
> {noformat}
> [1] http://answers.semanticweb.com/questions/26343/outer-query-results-include-more-values-than-subquery-with-limit-n-produces/26344



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)