W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > December 2011

Re: ENCODE_FOR_LOCAL_NAME

From: David Booth <david@dbooth.org>
Date: Wed, 14 Dec 2011 14:07:37 -0500
To: Axel Polleres <axel.polleres@deri.org>
Cc: public-rdf-dawg-comments <public-rdf-dawg-comments@w3.org>
Message-ID: <1323889657.9602.62668.camel@dbooth-laptop>
Thank you.  I am satisfied with this resolution.

David

On Wed, 2011-12-14 at 18:50 +0100, Axel Polleres wrote:
> Hi David,
> 
> In response to http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2011Nov/0017.html
> 
>  > It would be helpful if SPARQL would define an ENCODE_FOR_LOCAL_NAME
>  > function.
>  > 
>  > At present, SPARQL provides the ENCODE_FOR_URI function to facilitate
>  > the generation of new URIs within SPARQL queries or updates.  This is
>  > helpful, however often one needs to generate a new URI with a fixed
>  > prefix and variable local name part, so that the generated URIs can be
>  > used conveniently in subsequent SPARQL, Turtle and RDF/XML contexts.
>  > But because the syntactic restrictions for local names (in SPARQL,
>  > Turtle and XML) are more stringent than for URIs in general, additional
>  > encoding is required.
> 
> The working group is capturing points as input for any future chartering process at
> 
> http://www.w3.org/2009/sparql/wiki/Future_Work_Items
> 
> where we have added this suggestion.
> 
> We would be grateful if you would acknowledge that your comment has been answered by sending a reply to this mailing list.
> 
> Axel, On behalf of the SPARQL WG
> 
> On 8 Nov 2011, at 03:33, David Booth wrote:
> 
> > It would be helpful if SPARQL would define an ENCODE_FOR_LOCAL_NAME
> > function.
> > 
> > At present, SPARQL provides the ENCODE_FOR_URI function to facilitate
> > the generation of new URIs within SPARQL queries or updates.  This is
> > helpful, however often one needs to generate a new URI with a fixed
> > prefix and variable local name part, so that the generated URIs can be
> > used conveniently in subsequent SPARQL, Turtle and RDF/XML contexts.
> > But because the syntactic restrictions for local names (in SPARQL,
> > Turtle and XML) are more stringent than for URIs in general, additional
> > encoding is required.
> > 
> > For example, in
> > 
> >   PREFIX ex: <http://example/>
> >   . . .
> >   BIND(uri(concat(str(ex:), encode_for_uri("Frankfurt"))) AS ?city)
> > 
> > ?city becomes <http://example/Frankfurt>, which can be conveniently
> > written as:
> > 
> >   ex:Frankfurt
> > 
> > But if instead we have
> > 
> >   BIND(uri(concat(str(ex:), encode_for_uri("Los Angeles"))) AS ?city)
> > 
> > then encode_for_uri returns "Los%20Angeles", so ?city becomes
> > 
> >   <http://example/Los%20Angeles>
> > 
> > which cannot be written as
> > 
> >   ex:Los%20Angeles
> > 
> > because "%" is forbidden in a local name.  However,
> > 
> >   encode_for_local_name("Los Angeles")
> > 
> > would instead return a more stringently escaped string that would be
> > guaranteed legal in a local name.  For example, it could return
> > "Los_P20Angeles" (having "%" further encoded as "_P").  There are many
> > ways this encoding could be done; this is just one example.  Ideally the
> > SPARQL spec should pick one particular way as the standard (or the
> > default).
> > 
> > I do not expect the working group to be able to address this for the
> > current release of SPARQL, but I would be grateful if it could be placed
> > on a wish list for the next version.
> > 
> > Thanks!
> > 
> > --
> > David Booth, Ph.D.
> > http://dbooth.org/
> > 
> > Opinions expressed herein are those of the author and do not necessarily
> > reflect those of his employer.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 
> 

-- 
David Booth, Ph.D.
http://dbooth.org/

Opinions expressed herein are those of the author and do not necessarily
reflect those of his employer.
Received on Wednesday, 14 December 2011 19:08:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 14 December 2011 19:08:15 GMT