- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Fri, 27 May 2005 20:26:44 +0100
- To: Jeen Broekstra <jeen@aduna.biz>
- Cc: RDF Data Access Working Group <public-rdf-dawg@w3.org>
Jeen Broekstra wrote:
> Seaborne, Andy wrote:
>
>> 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.
>
>
> Grammar issues aside I'd like to see a use case before we decide to put
> it in.
One might be
SELECT ?shop
WHERE
{ ?shop a x:Store ;
x:sales ?sales ;
x:costs ?costs .
}
ORDER BY (?sales - ?costs)
to order by profitablitity of a store location.
Andy
>
>> 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.
>
>
> Seconded on #0.
>
>
> Jeen
Received on Friday, 27 May 2005 19:26:57 UTC