Re: Update on ORDERing solutions

Steve Harris wrote:
> On Fri, Mar 18, 2005 at 04:45:49 +0000, Andy Seaborne wrote:
> 
>>3/ Syntax
>>
>>SQL's "ORDER BY" clause
>>
>>XQuery also has an "order by" clause: it specifies the modifiers in full: 
>>"ascending" and "descending".  Each system can take an expression or a 
>>column name (in SQL's case also a number).
>>
>>
>>Proposed syntax (examples):
>>
>>SELECT *
>>WHERE { :x :p ?v . :x :q ?w }
>>ORDER BY ?v ?w
>>LIMIT  10
>>OFFSET 10
>>
>>
>>Confusion point: SPARQL does not have commas so I omitted them here too but 
>>then
>>
>>ORDER BY ?v DESCENDING ?w
>>
>>is confusing (it means descending-in-?v, ascending-in-?w but is very easy 
>>to miss read).
>>
>>Alternative syntax: break from SQL, XQuery and have
>>  DESC(?v) ?w
>>or some other clear association of modifier with expression.
>>
>>I prefer the (non-SQL) DESC(?x), ASC(xsd:integer(?x)) style for clarity.
> 
> 
> Without commas? So do I, I think. I'm not toally happy about the fact that
> ASC and DESC appear to be functions, unless they have some defination in
> that sense.

ASC[] and DESC[] would be a different from functions.  How's that?

ASC[?x]
DESC[xsd:integer(?v)]

It would be nice to have a joining trailing marker

?x\ASC
xsd:integer(?v)\ASC

but I I can't think of one. \ is not a good choice!

>  
> 
>>4/ Ordering Expressions
>>
>>We have a requirement (3.3) for extensible value testing.  Therefore, I put 
>>in expressions for ordering (like xquery, SQL) which allows types unknown 
>>to the core language to be ordered.  This also allows casting (useful for 
>>dates in non-xsd:dateTime format or older RDF without datatypes).
>>
>>ORDER BY xsd:integer(?v)
>>
>>ORDER BY app:cordOrder(?x, ?y)
>>
>>Such an ordering function must not cause an evaluation failure.  If it 
>>does, it is not determined whether any results, some results or all the 
>>results in some junk order are returned.
> 
> 
> What does it return? A positional decimal? comparison function style -1,
> 0, +1?

It returns an RDF value like any other function.  This isn't the collation 
function, it is a transformation of the data.  cf. xsd:integer(?v) or 
xsd:dateTime(?myDateFormat)

	Andy

> 
> - Steve 
> 

Received on Monday, 21 March 2005 11:44:40 UTC