Re: Details of string operations

On 2010-12-04, at 20:25, Andy Seaborne wrote:
> On 02/12/10 14:36, Steve Harris wrote:
>>> >  No strong opinion here but there is a reason:
>>> >
>>> >  My thinking was that if there is an xsd:string from the data, but the query writes a simple literal (convenience) then the result is typed.
>>> >
>>> >  e.g. CONCAT(?var1, " ->  ", ?var2)
>>> >
>>> >  and ?var1 and ?var2 are xsd:strings from the data.
>> I see where you're coming from, but you could equally write CONCAT(?var1, " ->  "^^xsd:string, ?var2), if you cared about the distinction for some reason.
> 
> The two cases I think matter are (when no lang tags around):
> 1/ All the data is simple literals
> 2/ All the data is xsd:strings
> 
> Making the output of CONCAT(?var1, " ->  ", ?var2) when ?var1 and ?var2 are xsd:strings means that this form works for both cases.

I think there's a word missing from the sentence?

>> CONCAT(plain, anything) -> plain
>> CONCAT(string, string) -> string
> 
> CONCAT(simple, anything) -> anything

But if CONCAT(plain, string) gives plain, you don't need that case, it falls out naturally as "simple" literals are a subset of plain.

> "plain" is two cases: simple and with-lang and we have lang-compatibility rules. Treat lang tags like datatypes (which is OK because you can't have lang and a real datatype).

Lang tags complicate things, certainy, but they shouldn't affect the type.

- Steve

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD

Received on Sunday, 5 December 2010 15:48:33 UTC