New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FILTER with numerical constant does not work #114
Comments
I think I know the source of the problem: Value literals are stored in a special form in QLever (":value00000..."). Your bug looks like the translation of the filter value "1000000" into this form is not performed and thus this value is transformed into an Id which is smaller than that of All numeric literals (because '1' < ':' in ASCII). Since this is not the part of the QLever source I am familiar with, I would recommend @niklas88 or @floriankramer to check where this could be implemented best. (As far as I've seen the SparqlParser directly constructs the list of Filters, so probably it should be somewhere there). |
Ok so it turns out this does work:
Because currently QLever intentionally‽ only checks if the right hand side of the comparison is an XSD literal. Interestingly it looks like the |
Thanks for investigating this, Niklas!
Does it also work if the constant on the right-hand side is not in the
vocabulary?
…On 29.08.2018 16:20, Niklas Schnelle wrote:
Ok so it turns out this does work:
|SELECT ?city ?country ?population WHERE { ?city <is-a>
<City/Town/Village> . ?country <is-a> <Country> . ?city <Contained_by>
?country . ?city <Population> ?population . FILTER (?population <
"10000"^^xsd:integer) } ORDER BY DESC(?population) |
Because currently QLever intentionally‽ only checks
<https://github.com/ad-freiburg/QLever/blob/10c01c362d6c9c9eaf573aff177eac70fdd5b37d/src/engine/QueryPlanner.cpp#L1390>
if the right hand side of the comparison is an XSD literal.
Interestingly it looks like the |FILTER| comparisons also aren't
symmetric, i.e. constants only work on the right side.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#114 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ANUinEbxFbpvAeAR7n80Wy0L_sgK65fpks5uVqMXgaJpZM4WQCrR>.
|
@hannahbast yes it does. Also I'm currently working on supporting normal numeric constants as they are definitely in the SPARQL spec (see the PR linked here). Interestingly this actually kind of is a problem with the SPARQL parser as in a proper parser that would've already converted literals to their correct type. So my fix is kind of a workaround until we get the parser fixed. |
For example, on Wikipedia+FreebaseEasy, the following query does not work as expected (the result is empty, and with > instead of < nothing is filtered):
The text was updated successfully, but these errors were encountered: