W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2004

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

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Thu, 4 Nov 2004 10:28:37 -0000
Message-ID: <8D5B24B83C6A2E4B9E7EE5FA82627DC94D2FCC@sdcexcea01.emea.cpqcorp.net>
To: "RDF Data Access Working Group" <public-rdf-dawg@w3.org>

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:21 GMT