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

Re: function library summary and issues

From: Steve Harris <steve.harris@garlik.com>
Date: Wed, 24 Nov 2010 19:27:51 +0000
Message-Id: <5EDB3F90-A157-478B-AF1A-24B126476431@garlik.com>
Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
To: Gregory Williams <greg@evilfunhouse.com>
On 24 Nov 2010, at 18:40, Gregory Williams <greg@evilfunhouse.com> wrote:

> On Nov 24, 2010, at 1:12 PM, Steve Harris wrote:
> 
>> On 2010-11-24, at 15:20, Andy Seaborne wrote:
>> 
>>> Practicality suggests simple literals are important.
>>> We can overlay on XSD F&O so for example:
>>> 
>>> CONCAT("a"^^xsd:string, "b"^^xsd:string) -> "ab"^^xsd:string
>>> CONCAT("a", "b") -> "ab"
>>> CONCAT("a"^^xsd:string, "b") -> "ab"^^xsd:string (?? choice point)
> 
> I think I'd want this to produce a simple literal, but as Steve says, without experience here it's hard to know.
> 
>>> CONCAT("a"@en, "b"@fr) -> error? (choice point [*])
>>> CONCAT(str("a"@en), str("b"@fr)) -> "ab"
>>> 
>>> [*] lang tag support in comparisons etc is not required by base SPARQL so it's an error. The question is whether to provide guidance to implementations that wish to provide it.
>> 
>> Re. [*], for impl's which choose to implement it, I would favour "ab" as a result. We use language tags quite a bit, and though we haven't been able to concatenate them up to now, I would like/expect CONCAT("a"@en, "b"@fr) -> "ab". Less straightforward is CONCAT("a"@en", "b"@en), should that be "ab"@en, or "ab". Dropping the lang tag in all cases seems fine to me.
> 
> I also would prefer CONCAT("a"@en, "b"@fr) -> "ab". I have no preference on whether concat of two literals with the same language tag should yield a language tagged literal.
> 
>> What about CONCAT("1"^^xsd:integer, "2"^^xsd:integer), following F&O strictly it would be "12"^^xsd:string I believe.
> 
> I'm a bit freaked out that this is going to cause confusion if + is also being used for string concat (assuming we follow the strawpoll support for overloading +). + would yield addition over xsd:integers, while the CONCAT() syntax would yield "12" with xsd:integers. Something doesn't seem right about that.

I agree that it seems a bit strange, but it's a consequence of combining a weakly typed language with operator overloading. 

Even some strongly typed languages have this sort of oddity, e.g. Java's StringBuffer.append() appears to take a bunch of types as an argument, but + only works on pairs of numeric types, or strings, as far as I can tell. Not being a java user, I don't know how this pans out in practice. 

- Steve
Received on Wednesday, 24 November 2010 19:29:10 GMT

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