RDFLib/rdflibissueplayground — Issue #29: DESC() & ASC() broken in ORDER BY clauses
Author: gjhiggins
Created: 2012-02-20 05:28:43+00:00
State: open
Labels: closed

christop...@gmail.com, 2011-02-06T11:52:57.000Z
Passing query 'SELECT ?s WHERE {?s ?p ?o} ORDER BY DESC(?s)' will raise an Exception:

...
File "/tmp/env/lib/python2.6/site-packages/rdflib/graph.py", line 770, in query
return result(processor.query(query_object))
File "/tmp/env/lib/python2.6/site-packages/rdfextras-0.1a-py2.6.egg/rdfextras/sparql/processor.py", line 43, in query
extensionFunctions=extensionFunctions)
File "/tmp/env/lib/python2.6/site-packages/rdfextras-0.1a-py2.6.egg/rdfextras/sparql/algebra.py", line 402, in TopEvaluate
"Support for ORDER BY with anything other than a variable is not supported: %s"%order_expr
AssertionError: Support for ORDER BY with anything other than a variable is not supported: FILTER o

This bug is triggered by errorneous parsing. In addition to the wrong parse result the algebra will raise an Exception as no simple variable is produced by the parser when following rules defined in the SPARQL specification (http://www.w3.org/TR/rdf-sparql-query/#rOrderCondition).

See attached patch for a fix addressing both issues.

Comment 1 by gromgull
This issue was closed by revision 0ae662532a.