SPARQL中的UTF-8格式 [英] UTF-8 formatting in SPARQL
问题描述
我如何向SPARQL说"?教会名称采用UTF-8格式?因为回应就像:Pražskýhrad
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#>
PREFIX abc: <http://dbpedia.org/class/yago/>
SELECT ?churchname
WHERE
{
<http://dbpedia.org/resource/Prague> 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
PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
PREFIX abc: <http://dbpedia.org/class/yago/>
SELECT ?churchname
WHERE
{
<http://dbpedia.org/resource/Prague> 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
推荐答案
恐怕有些问题了:在SPARQL中无法做到这一点. SPARQL适用于字符数据(而不是字节),因此编码与它无关.
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.
您的选择是:
-
查看SPARQL端点是否支持扩展功能来更改编码.我相当确定这是不存在的,但是也许virtuoso的某人(看起来您正在使用)知道的更好.
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.
获取结果后将其修复.我知道不是很理想
Fix the results when you get them. Suboptimal, I know,
这篇关于SPARQL中的UTF-8格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!