W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > January 2006

Re: major technical: orthogonality (expressions in SELECT, ORDER BY) [OK?]

From: Dan Connolly <connolly@w3.org>
Date: Thu, 12 Jan 2006 17:18:13 -0600
To: Fred Zemke <fred.zemke@oracle.com>
Cc: public-rdf-dawg-comments@w3.org
Message-Id: <1137107894.19546.435.camel@dirk.w3.org>

On Thu, 2006-01-12 at 13:41 -0800, Fred Zemke wrote:
> Section 10.1.3 "ORDER BY"
> says that an ordering condition can be a variable or a function
> call.  This points up a non-orthogonality in the design: function
> calls are allowed in the ORDER BY but not the SELECT list.  And expressions
> are not allowed in either.  The workaround is to add a variable to
> a query and use it to compute the expression.  Example: suppose you
> want to order by (price + tax).  You can write
> SELECT ?item
> WHERE { ?item v:price ?price . ?item v:tax ?tax .
>         FILTER (?sum = ?price + ?tax) }
> ORDER BY ?sum
> But why is this workaround required for any expression in the SELECT
> list, and any expression except a function call in the ORDER BY?

Actually, FILTER doesn't introduce solutions like that; it
only eliminates them.

And expressions are allowed in ORDER BY.

[16]   OrderCondition   ::=    ( ( 'ASC' | 'DESC' )
BrackettedExpression )
| ( FunctionCall | Var | BrackettedExpression )

But you're correct to point out that ORDER BY takes expressions
but SELECT does not.

By any chance does this clarification address your comment
to your satisfaction? If not, please let us know how you
would prefer to see the design change.

Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E
Received on Thursday, 12 January 2006 23:18:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:52:07 UTC