[OK?] Re: some questions on ORDER BY

Hello Faisal,

Faisal.Alkhateeb@inrialpes.fr wrote on 03/02/2006 05:29:44 AM:

> Hello,
> 
>   I have some questions regarding ORDER BY. If we have the following 
one:
> 
>               ORDER BY (lang (_:b))
> How we can evaluate this and then ordering the set of solutions?
> 
> Also if we have:
> 
>          ORDER BY (<http://example.org>)
> How we can order the results?

The SPARQL Query Language specification does not define ordering on 
bnodes; and while it does define ordering on IRIs, ordering by a constant 
IRI will, of course, not produce a total ordering. For both of these 
cases, then, the following text from section 10.1.3 of the specification 
applies ( http://www.w3.org/2001/sw/DataAccess/rq23/#modOrderBy ):

"""
If the ordering criteria do not specify the order of values, then the 
ordering in the solution sequence is undefined.
"""

> What are the semantics of Order Conditions when they don not 
containvariables 
> like the above examples?

The semantics of ORDER BY are not altered by the presence or lack of 
variables (though many instances of ORDER BY without variables will (as 
above) not result in a total ordering of the solutions). The text from the 
above cited section of the Last Call document reads:

"""
The "<" operator (see the Operator Mapping) defines the relative order of 
pairs of numerics, xsd:dateTimes and xsd:strings.

IRIs are ordered by comparing the character strings making up each IRI 
using the "<" operator.

SPARQL also defines a fixed, arbitrary order between some kinds of RDF 
terms that would not otherwise be ordered. This arbitrary order is 
necessary to provide slicing of query solutions by use of LIMIT and 
OFFSET.

   1. (Lowest) no value assigned to the variable or expression in this 
solution.
   2. Blank nodes
   3. IRIs
   4. RDF literals
   5. A plain literal is lower than an RDF literal with type xsd:string of 
 the same lexical form.

If the ordering criteria do not specify the order of values, then the 
ordering in the solution sequence is undefined.

Ordering a sequence of solutions always results in a sequence with the 
same number of solutions in it, even if the ordering criteria does not 
differentiate between two solutions.
"""

Please let us know if you find this response satisfactory.

thanks,
Lee

Received on Friday, 3 March 2006 08:35:03 UTC