Comparison with non-standard datatypes

Dear working group,

I would like to suggest to add more openness and flexibility to SPARQL's handling of typed literals. Currently

ASK WHERE {
	FILTER ("42"^^xsd:float > "8"^^xsd:float)
}

returns true. However, the following query with user-defined datatypes (here: unit:Meter) does not work

ASK WHERE {
	FILTER ("42"^^unit:Meter > "8"^^unit:Meter)
}

Could you please consider generalizing the Operator Mapping

http://www.w3.org/TR/2011/WD-sparql11-query-20110512/#OperatorMapping

so that all unknown datatypes default to 'numeric' treatment, so that their literal lexical form is mapped to decimal numbers? I guess the same algorithm would be needed in places like ORDER BY.

We have real-world use cases where we would like to exchange product data with units, and all of them are essentially numeric. The current work-around

ASK WHERE {
	FILTER (xsd:float("42"^^unit:Meter) > xsd:float("8"^^unit:Meter))
}

(which works) looks overly complex and not generic. I believe opening this up will future-proof SPARQL before it gets frozen again for many years.

Thanks for your consideration,
Holger

Received on Friday, 3 June 2011 05:42:57 UTC