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!


Reply via email to