You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Simon Helsen (JIRA)" <ji...@apache.org> on 2013/04/12 17:54:18 UTC

[jira] [Comment Edited] (JENA-432) Filter optimization messes up when a nested select is present in the same block

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

Simon Helsen edited comment on JENA-432 at 4/12/13 3:53 PM:
------------------------------------------------------------

no, the following query

SELECT ?test ?p1
WHERE {
  ?test ?p1 ?s2.
  FILTER ( ?test = <http://localhost/t1> || ?test = <http://localhost/t2> )
  { SELECT ?s1
    { ?s2 ?p2 ?o2 }
  }
} 

may have a more realistic flavor to it, i.e. you do something in a sub query, use that result in a bgp which is further restricted using a FILTER with an || assignment pattern (so the optimizer will attempt to expand the assignments). It still produces the following bogus plan:

(project (?test ?s1)
  (disjunction
    (table empty)
    (table empty)))

                
      was (Author: shelsen):
    no, the following query

SELECT ?test ?p1
WHERE {
  ?test ?p1 ?s2.
  FILTER ( ?test = <http://localhost/t1> || ?test = <http://localhost/t2> )
  SELECT ?s1
    { ?s2 ?p2 ?o2 }
} 

may have a more realistic flavor to it, i.e. you do something in a sub query, use that result in a bgp which is further restricted using a FILTER with an || assignment pattern (so the optimizer will attempt to expand the assignments). It still produces the following bogus plan:

(project (?test ?s1)
  (disjunction
    (table empty)
    (table empty)))

                  
> Filter optimization messes up when a nested select is present in the same block
> -------------------------------------------------------------------------------
>
>                 Key: JENA-432
>                 URL: https://issues.apache.org/jira/browse/JENA-432
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 2.10.0
>            Reporter: Simon Helsen
>
> The following test query:
> SELECT ?test ?s1
> WHERE {
>   ?test ?p1 ?o1.
>   FILTER ( ?test = <http://localhost/t1> || ?test = <http://localhost/t2> )  
>   OPTIONAL {
>     SELECT ?s1
>     { ?s1 ?p2 ?o2 }
>   }
> }
> produces the following plan:
> (project (?test ?s1)
>   (disjunction
>     (table empty)
>     (table empty)))
> Something goes wrong with the FILTER expansion. As a workaround, we observed that the following variation:
> SELECT ?test ?s1
> WHERE {
>   { ?test ?p1 ?o1.
>     FILTER ( ?test = <http://localhost/t1> || ?test = <http://localhost/t2> )  
>   }
>   OPTIONAL {
>     SELECT ?s1
>     { ?s1 ?p2 ?o2 }
>   }
> }
> produces the correct plan:
> (project (?test ?s1)
>   (leftjoin
>     (disjunction
>       (assign ((?test <http://localhost/t1>))
>         (bgp (triple <http://localhost/t1> ?p1 ?o1)))
>       (assign ((?test <http://localhost/t2>))
>         (bgp (triple <http://localhost/t2> ?p1 ?o1))))
>     (project (?s1)
>       (bgp (triple ?s1 ?/p2 ?/o2)))))

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira