Type Promotion

Section 11.1.1 of 2005-03-17 editor's draft states:

"In addition, any r:Literal may be is cast to xs:string or xs:numeric when
used as an argument to an operator expecting that type."

I think it's a mistake to automatically promote literals to numerics because
it will make it impractical for large triples stores to use indices to
efficiently implement operators.

For example:

#find all things within a certain longitude/latitude range
select ?s where { ?s tiger:long ?lon; tiger:lat ?lat. 
	filter ?lon > 44020278 && ?lon < 44123021
		&& ?lat > -73429239 && ?lat < -73249701}

(fyi, see http://labs.intellidimension.com/tiger/ for a more complete
example of this query in action)

The query processor will not be able to assume that it can use the index to
quickly access the desired values because there may be literal values that
are coercible into numeric values (alternatively, the triple store could
have attempted to coerce every literal on insertion and multiply indexed
those that could be, but that seems like an unnecessary and potentially
costly burden -- especially if the list of valid coercions grew). Instead
the query processor will have to get all values and winnow the results
according to the filter.

I'd recommend requiring an explicit cast for literal to numeric coercions.
 
Geoff Chappell

Received on Friday, 18 March 2005 19:48:52 UTC