Re: Sorting

On Mar 8, 2005, at 3:49 PM, Danny Ayers wrote:
> On Tue, 8 Mar 2005 15:08:16 -0600, Dan Connolly <connolly@w3.org> 
> wrote:
>>
>>> Is it the case then that Sparql will not include an ORDER BY or
>>> similar clause? If not, then would it be possible to elaborate
>>> why?
>>
>> We adopted a LIMIT requirement over an objection (details below), but
>> sorting has never had a critical mass of support. It competes with
>> streaming results (http://www.w3.org/2001/sw/DataAccess/UseCases#r3.12
>> ). We haven't discussed any designs for sorting.
>
> I don't understand why sorting should compete with streaming - isn't
> the transport at a different layer than order?

Er... no. The bytes coming over the wire (in the variable binding 
results)
are ordered. In order to sort the results, you can't send one along as 
soon as
you establish that it matches the query; you have to wait until
you have all the results, since the last one you find might be
the first one by the sort order.


>> You're welcome to elaborate on why you think it's important/required.
>> Use cases are particularly welcome, especially use cases that argue 
>> for
>> handling sorting in SPARQL rather than in a downstream component or
>> client or XSLT engine or the like.
>
> Use case: obtain a given number of most-recent items from a
> triplestore-based RSS aggregator. (Something along the lines of
> http://pubsub.com which aggregates data from several million feeds -
> they use ASN.1 internally btw, though expose XML interfaces).
>
> I may be missing something, but the most natural way I can think of
> doing this is using a combination of ORDER BY and LIMIT.

True, to get the "most recent N" you need both ORDER BY
and LIMIT. I think we discussed that case and there wasn't
a sense that it was critical for SPARQL 1.0, but I don't know
where that discussion is recorded, so I guess I'll ask again.

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/

Received on Tuesday, 8 March 2005 23:21:41 UTC