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

Theer are two separate issues: matching in triple patterns and testing
in comparisions.  Alberto illustrates the matching.  My opinion is that
"47"^^xsd:integer and "47" do not represent the same value and so do not
match in triple patterns and this is a reasonable expectation to the
application writer.


The plain literal case is more about comparison: 

========== Data

:x :prop "47" .

========== Query 

SELECT ?x WHERE (?x :prop ?v) AND ?v > 40 


	Andy


-------- Original Message --------
> From: Alberto Reggiori <>
> Date: 3 November 2004 20:53
> 
> 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.
> 
> +1
> 
> 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
> 
> Yours
> 
> Alberto
> 
> -
> Alberto Reggiori, Senior Partner, R&D @Semantics S.R.L.
> alberto@asemantics.com  www.asemantics.com
> Milan Office, milano@asemantics.com,   +39 0332 667092

Received on Thursday, 4 November 2004 10:29:09 UTC