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

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 )
 http://www.w3.org/TR/rdf-sparql-query/#rOrderCondition


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