From SPARQL Working Group
John Snelson wrote:
> The specification for "ORDER BY" 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  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, 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, 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