W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2005

Sorting

From: Steve Harris <S.W.Harris@ecs.soton.ac.uk>
Date: Mon, 15 Aug 2005 11:05:13 +0100
To: DAWG public list <public-rdf-dawg@w3.org>
Message-ID: <20050815100513.GE4129@login.ecs.soton.ac.uk>

I now have a crude implementation of ORDER BY, but I'm finding the
arbitrary ordering specified in the language spec. a bit inconvientient.

For example, if you have:

	SELECT ?v
	WHERE { ?x rdf:value ?v .
	        FILTER(datatype(?v) = xsd:decimal) }
	ORDER BY DESC(?v)
	LIMIT 10

you might hope to get the highest v's back, but to my reading of the
spec you will get back the one with the most 9s at the start, or something
similar, as the ordering is lexical.

One way to get that might be allow casting in the ORDER BY constraint
(ORDER BY DESC(xsd:decimal(?v)), but that adds complexity, and I'm not a
fan of that. Another would be to relax the constraints on what the order
must be (eg, to just ensuring that its consistant), to allow the
implementations to do something sensible.

The current spec. seems to lead you to something which is quite
complicated to implement, but the complexity doesn't add much capability.

- Steve
Received on Monday, 15 August 2005 10:05:53 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:24 GMT