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

ORDER BY under-specified

From: Richard Newman <r.newman@reading.ac.uk>
Date: Sat, 3 Jun 2006 21:12:23 -0700
Message-Id: <08DD7DF8-300C-4BC8-9F2B-A057A26697BD@reading.ac.uk>
To: public-rdf-dawg-comments@w3.org

<http://www.w3.org/2001/sw/DataAccess/rq23/#modOrderBy>

"An ordering condition can be a variable, a function call or an  
expression."

There are no examples in the document of the use of a function call  
or expression. Presumably "an expression" refers to [46] Expression  
in the grammar. As far as my reading goes the document is not clear  
on the role of these; whether the function or expression should:

- return a value when applied to each binding, which is then sorted by <
- somehow return a boolean when evaluated in the context of two bindings
- do something else

though I am sure that anything but the first of these would be  
confusing and difficult to express.


Suggestions:

- explain more clearly what is meant by 'expression' (I'm writing a  
query engine, so I'm fine looking at the grammar, but someone reading  
the document perhaps will not), ideally defining the term in the  
appropriate place in the document and giving a cross-reference
- define the role of the function/expression in the actual ordering  
process
- provide an example of each
- introduce the role of '<' more clearly.

Assuming that I'm interpreting the document correctly, a  
supplementary paragraph such as the following would be suitable for  
the last:

"An ORDER BY clause specifies a sequence of conditions that are used  
to assign an order to a sequence of results. Each condition is  
evaluated in turn against each binding to yield an intermediate  
value; these intermediates are compared by the "<" operator to yield  
an order. If a condition is not sufficient to achieve an ordering  
(which is to say that (x < y) = (y < x)), the next condition in the  
sequence is used. If no order conditions yield an ordering, the  
elements to be compared have an undefined order."

It might also be worth indicating that ordering on

c1, c2, c3

is equivalent to

(sort (sort (sort results c3) c2) c1)

if, in fact, it is (too late at night, but a quick run through on  
paper seems to suggest that that is the case).

Regards,
-R
Received on Sunday, 4 June 2006 04:12:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:50 GMT