-
Notifications
You must be signed in to change notification settings - Fork 555
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
Unexpected behaviour in Filter Query #532
Comments
(i took the liberty to make the report self-contained, reformat and fix some minor bugs in it.) i can reproduce this problem... the same query without as the parsed query contains a Here's the what i think relevant part of the parsed query: RelationalExpression_{'_vars': set([rdflib.term.Variable(u'date')]), 'expr': rdflib.term.Variable(u'date'), 'other': rdflib.term.Literal(u'2004-06-20'), 'op': '>='} Digging into the parsing and finding @gromgull i'm not entirely sure that what i'm doing there is the right thing, as i guess it should be possible to in general parse Literals with unknown datatype IRIs, which made it a bit surprising to me that this worked... any idea what's going on? |
I cannot replicate the missing DT, if I do: rdflib.plugins.sparql.prepareQuery('prefix xsd: I get: Filter_{' [... blah ... ] 'other': rdflib.term.Literal(u'123', The problem is here: https://github.com/RDFLib/rdflib/blob/master/rdflib/plugins/sparql/operators.py#L795 XSD.date is not in the list, so this triggers, and the filter Out of the basic date time types (http://www.w3.org/TR/xmlschema-2/#isoformats) duration, dateTime, time, date, gYearMonth, gMonthDay, gDay, gMonth and gYear only datetime is present. Digging a bit deeper, this is because only these are required by the http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#operandDataTypes And therefore the tests also only use these. Both date and time are correctly handled by rdflib Literals, I see no duration could probably be mapped to datetime.timedelta, but that is Do all tests pass if you add date/time? :)
On 23 October 2015 at 19:10, Jörn Hees notifications@github.com wrote:
|
thanks, seems the debugger tricked me by pretty printing unicode subtypes without properly using their the PR in #533 adds I'm still not sure if for all other types the comparison result should be a silent |
SPARQL can now compare xsd:date type as well, fixes #532
Thanks for this. I applied the patch and it works. IMHO, It should raise an error, I think xsd:date is the only one that works when casted to String. I should then be able to implement the comparison I need through a custom eval. Perhaps is also worthy to update the docs to state clearly that you support querying only on the specified SPARQL 1.1 types plus xsd:date. I incorrectly believed that I could query on all the xsd types supported by Literal (https://rdflib.readthedocs.org/en/stable/rdf_terms.html) |
Hi,
rdflib 4.2.1 on Ubuntu 14.04 LTS, python 2.7.10
I'm running the following query on this data in
MEPs.n3
:query:
The dataset contains only one entity, and I expect it to be returned in the result, but that is not the case. If I remove the FILTER clause, the result is not empty, as expected.
The query works in other libraries (Corese, Jena, a virtuoso endpoint)
The text was updated successfully, but these errors were encountered: