virtuoso-opensource icon indicating copy to clipboard operation
virtuoso-opensource copied to clipboard

`FILTER EXISTS` breaks `LIMIT`

Open mielvds opened this issue 1 year ago • 2 comments

When running the following query, I get 10000 results (the result limit) while I expected 1.

prefix premis: <http://www.loc.gov/premis/rdf/v3/>
select distinct * where {
  ?id a premis:File .
  filter exists {
    ?id a premis:File .
  }
} limit 1

Unfortunately, I can't share the dataset, which makes reproducing the issue difficult, but the limit should work in any case. I'm not sure, but it only seems to happen when the result size is larger or equal to the configured limit of 10000. We're using version 7.2.6-7. Furthermore, this also breaks the use of OFFSET, which no longer has any effect.

I tried a similar query

select distinct * where {
?p a schema:Person.
filter exists {
?p a schema:Person.
}
} limit 1

on https://dbpedia.org/sparql, but that works fine.

mielvds avatar Aug 23 '24 07:08 mielvds

You indicate running Virtuoso 7.2.6-7, which is not an official Virtuoso Open Source release and is rather old, thus where did you acquire it from? In any case, we would recommend that you upgrade to the latest Virtuoso 7.2.13 Open Source release and see if the problem persists.

Have you run a database integrity check to determine if there might be any corruption in the database?

HughWilliams avatar Aug 23 '24 09:08 HughWilliams

Sorry, the -7 is an image name by our service provider. I'll do a test locally.

mielvds avatar Sep 02 '24 14:09 mielvds