I am trying to lookup information regarding someone on Dbpedia but their name contains parenthesis in this case ending with _(musician) which leads to an error.
SELECT ?birthPlace
WHERE {
dbpedia:Tom_Johnston_(musician) dbpprop:birthPlace ?birthPlace
}
Parentheses aren't legal in prefixed names, but you can just use the full URI instead:
SELECT ?birthPlace
WHERE {
<http://dbpedia.org/resource/Tom_Johnston_(musician)> dbpprop:birthPlace ?birthPlace
}
It's also possible to escape them using \
:
SPARQL local names also allow the non-alphanumeric characters allowed in IRIs via backslash character escapes (e.g. ns:id\=123).
SELECT ?birthPlace
WHERE {
dbpedia:Tom_Johnston_\(musician\) dbpprop:birthPlace ?birthPlace
}