literals as numbers (Was: Re: Comments on SPARQL draft)

On Nov 3, 2004, at 9:14 PM, Janne Saarela wrote:

>> I propose that SPARQL does not require processing plain literals as
>> numbers if they just happen to look like numbers.  Implementations 
>> would
>> be free to provide this if they choose to but it is outside the rec
>> (i.e. SPARQL does not forbid it either).
> I would agree plain literals can only be compared as strings
> but cannot say what the implications are if it was forbidden.


I would rather see the interpretation of literal as numbers as an 
indexing/storage problem rather then a search and retrieval one. 
Whether or not a storage would index each trimmed numerical string as a 
number is up to its stroage model. But the query language must provide 
a syntax to distinguish between the two cases.

> Would you have an example handy?

here is my attempt:

(?item some:prop "47")

would match the string "47" - while

(?item some:prop "47"^^xsd:integer)

would match the number 47 - but the above solution might imply the 
indexing of the rdf:datatype (even if not mandatory)

or use some function like

(?item some:prop "47")
(?item some:prop ?val) AND &isnum(?val)

default would be matching strings



Alberto Reggiori, Senior Partner, R&D @Semantics S.R.L.
Milan Office,,   +39 0332 667092

Received on Wednesday, 3 November 2004 20:53:24 UTC