Re: rq25.xml String functions definitions - first shot (ACTION-350)

Hi Steve,

I took http://lists.w3.org/Archives/Public/public-rdf-dawg/2010OctDec/0361.html as a basis, where the following was suggested:

"
ENCODES(string)
   Result is a simple literal regardless of string.
   string can be simple, or xsd:string
   Not clear to me it should apply to LitLang
     proposal: it does not (it is an error).
"

and I hadn't heard objections raised against this as of yet.
Is your proposal to extend encode() towards accepting plain literals with lang tags?

(would look ok from my side, and consistent with the remaining string functions that also allow this...)

Actually, I guess I even have a use case for this, i.e. URIs can also use language, e.g.

 http://www.weihnachten.at/
 http://www.christmas.co.uk/

If you want to create such language dependent URIs from text, you may want encode() to work on language tagged literals...

Axel




On 21 Dec 2010, at 11:32, Steve Harris wrote:

> On 2010-12-20, at 18:37, Axel Polleres wrote:
> >
> >          <p>The <code>encode</code> function is SPARQL's correspondent to the XPath <a href="http://www.w3.org/TR/xpath-functions/#func-encode-for-uri">fn:encode-for-uri</a> function and accepts simple literals  as well as <code>xsd:string</code> typed literals as input. It returns a simple literal with the lexical form obtained from the lexical form of its input after translating reserved characters according to the <a href="http://www.w3.org/TR/xpath-functions/#func-encode-for-uri">fn:encode-for-uri</a> function. For plain literals with language tag or typed literals with types other than <code>xsd:string</code> it returns a <a href="http://www.w3.org/TR/xquery/#dt-type-error" class="norm">type error</a>.</p>
> 
> Why should encode_for_uri("colour"@en-GB) be a type error?
> 
> I can understand that encode_for_uri("1"^^xsd:integer) could/should be a type error, because you can't encode the integer one in a URI, but you can encode the English word "colour" in a URI.
> 
> There's arguably some information loss, as you lose the language tag, but as URIs can't capture language tags I don't see that as an issue (like STR() and simple literals).
> 
> - 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 Tuesday, 21 December 2010 13:50:30 UTC