- From: Axel Polleres <axel.polleres@deri.org>
- Date: Wed, 14 Dec 2011 18:50:50 +0100
- To: David Booth <david@dbooth.org>
- Cc: "public-rdf-dawg-comments" <public-rdf-dawg-comments@w3.org>
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. > > > > > > > > > > > > > >
Received on Wednesday, 14 December 2011 17:51:51 UTC