- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Thu, 26 May 2005 10:49:07 +0100
- To: RDF Data Access Working Group <public-rdf-dawg@w3.org>
This is a comment that I forgot to process fully. This points out that ORDER BY
is restrictive in that it only provided for a variable or a function.
http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2005May/0005.html
Richard Cyganiak wrote:
> Comments on
> http://www.w3.org/2001/sw/DataAccess/rq23/
> regarding the ORDER BY clause:
>
>
>>From the grammar:
>
> | [16] OrderExpression ::= FunctionCall | Var
> | [59] FunctionCall ::= URI '(' ArgList ')'
>
> This doesn't allow expressions like "?a + ?b" in the ORDER BY clause. Is
> this intentional?
>
> If not, this sentence from section 10.1 also needs updating:
>
> | An ordering condition can be a variable or a function call.
There is no reason I can see not to allow an expression but the grammar need
tweaking.
We have the allowance for a fucntion because of the need to handle
domain-specific datatypes.
But we can't just put "Expression" at this point because this is ambigous: + and
- can occur both as unary and binary operators. We allow multiple ordering
conditions on a single line so
ORDER BY ?a + ?b
It's either two ordering conditions:
ORDER BY ?a
ORDER BY +?b
or it's one condition
ORDER BY (?a+?b)
We already have grouping using ASC/DESC. We choose [] (mildly) because ASC/DESC
aren't functions. We (for consistency) use blank separated lists of conditions.
0/ No change. Don't allow general expressions.
1/ change from using [] to using () for ASC and DESC
ORDER BY (?a+?b)
ORDER BY ASC(?a+?b)
2/ Make special cases for () expressions inside and outside [].
ORDER BY (?a+?b)
ORDER BY ASC[?a+?b]
3/ Always require () on expressions which are not simple variables or function
calls:
ORDER BY (?a+?b)
ORDER BY ASC[(?a+?b)]
4/ Only one condition per ORDER BY; multiple ORDER BY clauses.
I propose #0 :
For a change to support expressions, #1 is the best in my opinion.
#3 is downright ugly.
Context:
Standard SQL does not support expressions but some system do as an extension:
e.g. http://www.postgresql.org/docs/8.0/static/queries-order.html
MySQL 5.0 does not seem to mention it.
Andy
<snip class="stuff that has been dealt with"/>
Received on Thursday, 26 May 2005 09:49:21 UTC