SPARQL 中的 UTF-8 格式
我如何向 SPARQL“说”?churchname 采用 UTF-8 格式?因为响应类似于:PraŪská hrad
PREFIX lgv:
前缀 abc:
选择?教堂名称
哪里
<代码>{?教堂 lgv:castle 。
?church geo:geometry ?churchgeo 。
?church lgv:name ?churchname .
FILTER ( bif:st_intersects (?churchgeo,?gm, 10))
<代码>}GROUP BY ?教堂名称
按?教堂名称排序
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕有点无法回答:在 SPARQL 中无法做到这一点。 SPARQL 适用于字符数据(而不是字节),因此编码不是它所关心的事情。
您可能遇到此问题的原因有多种。首先,您可能错误地处理了结果。检查原始结果是否确实存在编码问题。
如果您做的是正确的事情,那么您看到的问题是数据已损坏,而且看起来编码问题确实已经蔓延到上游。
您的选项有:
查看 SPARQL 端点是否支持扩展函数来更改编码。我相当确定这不存在,但也许来自 virtuoso(看起来您正在使用的)的人更了解。
得到结果后修复它们。我知道这不是最理想的,
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:
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,