qlever
qlever copied to clipboard
FILTER with REGEX "^<" gives an empty result on IRIs
The following query produces an std:bad_alloc every time and returns a (wrongly) empty result.
PREFIX p: http://www.wikidata.org/prop/ PREFIX wd: http://www.wikidata.org/entity/ SELECT ?statement WHERE { wd:Q873 p:P166 ?statement . FILTER regex(?statement, "^<") }
This bug does not depend on anything special in the query except the "^<". It also occurs for any other predicate in place of the p:P166 and it also occurs with GROUP BY and HAVING as long as the regex is exactly "^<".
The query works just fine with regex "<" (no prefix search) or with "^..." where ... does not start with a <.
With "^<..." where ... is non-empty -- e.g. "^<http" -- there is no std:bad_alloc, but the result is still (wrongly) non-empty.
It's probably a small bug. But I'm surprised how it could survive for so long.
PS: The same problem occurs with the regex '^"' (std:bad_alloc). And something like '^"M' does not match literals with names starting with M. Again, when omitting the ^ everything works just fine.
Update:
The bad_alloc
is gone, but we still have the wrongly empty result on any prefix filter that starts with
"^<
. I think the bad_alloc
was fixed in connection with a similar error when filtering for all literals discovered by Claudius some time ago.
Fixed since #962 (the correct query now uses STR(?statement)
and the result of the STR
does not contain the <...>
anymore).