W3C home > Mailing lists > Public > public-sparql-dev@w3.org > April to June 2010

Re: Unallowed characters in concept names

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Thu, 24 Jun 2010 15:13:44 +0100
Message-ID: <4C236818.4080705@talis.com>
To: "Buikstra, A.P.F." <a.p.f.buikstra@student.vu.nl>
CC: "public-sparql-dev@w3.org" <public-sparql-dev@w3.org>
Apologies - () are allowed in URIs.

it's just that () are not allowed in prefixed names in SPARQL so you'll 
have to use a URI, either the full one or the version with BASE.

	Andy

On 24/06/2010 14:26, Andy Seaborne wrote:
> Try:
>
> <http://dbpedia.org/page/Orange_%28fruit%29>
>
> 1/ "(" and ")" aren't allowed in URIs, nor in prefixed names. Browsers
> kindly encode them into %28 and %29
>
> For example: go to
> http://dbpedia.org/page/Orange_(fruit)
> with Firefox and then cut and paste the contents of the URL bar into a
> text editor. You get %28-%29 (in FF 3.6 at least)
>
> 2/ This is an encoding, not an escape sequence - the URIs really do have
> "%-2-8" and "%-2-9" in them.
>
> 3/ SPARQL does not allow % in a prefixed name so you'll have to use
>
> WHERE
> {<http://dbpedia.org/page/Orange_%28fruit%29>
> ?p ?o . }
>
> or
>
> BASE <http://dbpedia.org/page/>
>
> SELECT ?p ?o
> WHERE { <Orange_%28fruit%29> ?p ?o . }
>
> The fact that <http://dbpedia.org/page/Orange_(fruit)> works is more
> luck than anything else :-)
>
> Andy
>
> On 24/06/2010 12:08, Buikstra, A.P.F. wrote:
>> Hi,
>>
>> My question is straightforward, but I didn't find it through Google.
>> Actually, I ran into someone with the same problem, but there was no
>> answer in the thread.
>>
>> How should I escape things like the parenthesis in:
>> PREFIX dbpedia:<http://dbpedia.org/resource/>
>> SELECT ?p ?o
>> WHERE { dbpedia:Orange_(fruit) ?p ?o . }
>>
>> (Gives error about "(" )
>>
>> Note that the following does work:
>> SELECT ?p ?o
>> WHERE {<http://dbpedia.org/resource/Orange_(fruit)> ?p ?o . }
>>
>> Thanks,
>>
>> Arjon Buikstra
>>
>> P.S. Thanks for the comments on my Union question, it really helped to
>> clarify the problem!
>>
Received on Thursday, 24 June 2010 14:14:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:15:50 UTC