You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (Jira)" <ji...@apache.org> on 2021/05/03 17:01:00 UTC

[jira] [Updated] (JENA-1963) Optimizer problem with NOT EXISTS and TransformFilterImplicitJoin

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

Andy Seaborne updated JENA-1963:
--------------------------------
    Description: 
This is an example from the SPARQL 1.1 spec.
It was reported to me directly and I refined it to isolate the problem to {{TransformFilterImplicitJoin}}.

Run with normal optimziation, we get the wrong answer:
{noformat}
~/tmp >> sparql --data D-exists.ttl --query Q-exists.rq 
------------
| x  | n   |
============
| :b | 3.0 |
| :a | 1   |
------------
{noformat}

With {{\--strict}}, or {{\--engine=ref}} or switching off just that one transform, we get the right answer.
{noformat}
~/tmp >> sparql --set=arq:optFilterImplicitJoin=false --data D-exists.ttl --query Q-exists.rq 
------------
| x  | n   |
============
| :b | 3.0 |
------------
{noformat}

Where {{D-exists.ttl}} is:
{noformat}
@prefix : <http://example.com/> .
:a :p 1 .
:a :q 1 .
:a :q 2 .

:b :p 3.0 .
:b :q 4.0 .
:b :q 5.0 .
{noformat}
and {{Q-exists.rq}} is:
{noformat}
PREFIX : <http://example.com/>
SELECT * WHERE {
        ?x :p ?n
        FILTER NOT EXISTS {
                ?x :q ?m .
                FILTER(?n = ?m)
        }
}
{noformat}

  was:
This is an example from the SPARQL 1.1 spec.
It was reported to me directly and I refined it to isolate the problem to {{TransformFilterImplicitJoin}}.

Run with normal optimziation, we get the wrong answer:
{noformat}
~/tmp >> sparql --data D-exists.ttl --query Q-exists.rq 
------------
| x  | n   |
============
| :b | 3.0 |
| :a | 1   |
------------
{noformat}

With {{--strict}}, {{--engine=ref}} or switching off just that one transform, we get the right answer.
{noformat}
~/tmp >> sparql --set=arq:optFilterImplicitJoin=false --data D-exists.ttl --query Q-exists.rq 
------------
| x  | n   |
============
| :b | 3.0 |
------------
{noformat}

Where {{D-exists.ttl}} is:
{noformat}
@prefix : <http://example.com/> .
:a :p 1 .
:a :q 1 .
:a :q 2 .

:b :p 3.0 .
:b :q 4.0 .
:b :q 5.0 .
{noformat}
and {{Q-exists.rq}} is:
{noformat}
PREFIX : <http://example.com/>
SELECT * WHERE {
        ?x :p ?n
        FILTER NOT EXISTS {
                ?x :q ?m .
                FILTER(?n = ?m)
        }
}
{noformat}


> Optimizer problem with NOT EXISTS and TransformFilterImplicitJoin
> -----------------------------------------------------------------
>
>                 Key: JENA-1963
>                 URL: https://issues.apache.org/jira/browse/JENA-1963
>             Project: Apache Jena
>          Issue Type: Bug
>    Affects Versions: Jena 3.16.0
>            Reporter: Andy Seaborne
>            Priority: Major
>         Attachments: D-exists.ttl, Q-exists.rq
>
>
> This is an example from the SPARQL 1.1 spec.
> It was reported to me directly and I refined it to isolate the problem to {{TransformFilterImplicitJoin}}.
> Run with normal optimziation, we get the wrong answer:
> {noformat}
> ~/tmp >> sparql --data D-exists.ttl --query Q-exists.rq 
> ------------
> | x  | n   |
> ============
> | :b | 3.0 |
> | :a | 1   |
> ------------
> {noformat}
> With {{\--strict}}, or {{\--engine=ref}} or switching off just that one transform, we get the right answer.
> {noformat}
> ~/tmp >> sparql --set=arq:optFilterImplicitJoin=false --data D-exists.ttl --query Q-exists.rq 
> ------------
> | x  | n   |
> ============
> | :b | 3.0 |
> ------------
> {noformat}
> Where {{D-exists.ttl}} is:
> {noformat}
> @prefix : <http://example.com/> .
> :a :p 1 .
> :a :q 1 .
> :a :q 2 .
> :b :p 3.0 .
> :b :q 4.0 .
> :b :q 5.0 .
> {noformat}
> and {{Q-exists.rq}} is:
> {noformat}
> PREFIX : <http://example.com/>
> SELECT * WHERE {
>         ?x :p ?n
>         FILTER NOT EXISTS {
>                 ?x :q ?m .
>                 FILTER(?n = ?m)
>         }
> }
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)