tags:

views:

35

answers:

1

How can I "say" to SPARQL that ?churchname is in UTF-8 formatting? because response is like:Pražský hrad

PREFIX lgv: <http://linkedgeodata.org/vocabulary#&gt;
PREFIX abc: <http://dbpedia.org/class/yago/&gt;
SELECT ?churchname
WHERE
{
<http://dbpedia.org/resource/Prague&gt; geo:geometry ?gm .
?church a lgv:castle .
?church geo:geometry ?churchgeo .
?church lgv:name ?churchname .
FILTER ( bif:st_intersects (?churchgeo,?gm, 10))
}
GROUP BY ?churchname
ORDER BY ?churchname

+2  A: 

Bit of a non-answer, I'm afraid: there is no way to do this in SPARQL. SPARQL works on character data (not bytes) so encoding isn't something it's concerned with.

There are a couple of reason you might have this problem. Firstly you might be handling the results incorrectly. Check whether the raw results do indeed have the encoding problem.

If you're doing the right thing then problem you are seeing is that the data is broken, and it certainly looks like a encoding issue has crept in upstream.

Your options are:

  1. See if the SPARQL endpoint supports an extension function to change the encoding. I'm fairly sure this doesn't exist, but perhaps someone from virtuoso (which it looks like you're using) knows better.

  2. Fix the results when you get them. Suboptimal, I know,