简体   繁体   English

转义为SPARQL中转换为URI的字符串

[英]Escape string for conversion to URI in SPARQL

Is there a simple way to escape a string in SPARQL when it is to be converted to a URI? 在转换为URI时,是否有一种简单的方法可以在SPARQL中转义字符串?

For instance, a string with "1 < 2" could be converted to "1%20%3C%202" . 例如,具有"1 < 2"的字符串可以转换为"1%20%3C%202"

I suppose a long series of calls to the REPLACE function could do it, following the pattern BIND(REPLACE(?string, '<', '%3C') AS ?escaped) ? 我想对REPLACE函数的一系列调用可以执行它,遵循模式BIND(REPLACE(?string, '<', '%3C') AS ?escaped)

There is a function ENCODE_FOR_URI : 有一个函数ENCODE_FOR_URI

ENCODE_FOR_URI("1 < 2") => "1%20%3C%202"

Specification: https://www.w3.org/TR/sparql11-query/#func-encode 规范: https//www.w3.org/TR/sparql11-query/#func-encode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM