Re: ORDER BY and literals

On Nov 6, 2012, at 7:29 PM, John Snelson wrote:

> The specification for "ORDER BY"[1] contains the following sentence:
> 
> "A plain literal is lower than an RDF literal with type xsd:string of the same lexical form."
> 
> Since the definition of the DATATYPE() function [2] describes the type of a simple literal as xsd:string, this sentence does not make any sense.
> 
> I suggest that the sentence quoted above be removed. In addition, the entries in the "variable bindings in ascending order" table relating to simple literals and literals typed explicitly as xsd:string needs to be revised.


John,

The values that SPARQL's DATATYPE() function returns are similar to, but not exactly the same as the datatype of a literal. In cases where DATATYPE() is called with a typed literal[1], it returns the datatype of the literal. However, the DATATYPE() function definition also defines two cases in which a value is returned when the literal *isn't* a typed literal:

"""
* If the literal is a simple literal, return xsd:string
* If the literal is literal with a language tag, return rdf:langString
"""

In both of these cases, the literal in question is a plain literal[2], not a typed literal. With that in mind, hopefully the language used in describing ORDER BY is more clear (that is, "an RDF literal with type xsd:string" is merely one of two possibly argument types for which DATATYPE() may return xsd:string).

I hope this clarifies the issue.

thanks,
gregory williams

[1] http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-typed-literal
[2] http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-plain-literal

Received on Wednesday, 21 November 2012 17:34:46 UTC