FILTER EXISTS inside OPTIONAL


(.) #1

Hello,
in Stardog 5.3.3 Community there seems to be an issue with FILTER EXISTS inside an OPTIONAL block (see Query #1).

Create an empty default database with reasoning being disabled both in the database and the query settings.
The stardog.log file does not show any entries about it.

Result R#1 -> Q#1:
?pet
(empty)

Result R#1 -> Q#2:
?pet
ex:Rex

Result R#1 -> Q#3:
?pet
ex:Rex

Request #1:

PREFIX ex: <http://example.org#>
INSERT DATA {
    ex:Rex a ex:Dog
}

Query #1:

PREFIX ex: <http://example.org#>
SELECT *
WHERE {
    OPTIONAL {
        BIND (ex:Rex AS ?pet)
        FILTER EXISTS { ?pet a ex:Dog }
    }
}

Query #2:

PREFIX ex: <http://example.org#>
SELECT *
WHERE {
    OPTIONAL {
        BIND (ex:Rex AS ?pet)
        ?pet a ex:Dog
    }
}

Query #3:

PREFIX ex: <http://example.org#>
SELECT *
WHERE {
    BIND (ex:Rex AS ?pet)
    FILTER EXISTS { ?pet a ex:Dog }
}

Best regards,
Palladium


(Pavel Klinov) #2

Thanks for the concise report, we’ll take a look.

Best,
Pavel


(Jess Balint) #3

Thanks for the bug report. I have created issue #5982 to track this.

Jess