我正在对graphdb SPARQL端点运行SPARQL查询,在此我进行了一些标准化和资源拆分。问题是我要添加的双引号在输出中变为双倍。像这样:
http://id.nlm.nih.gov/mesh/M0000259,"Acrodynia"",""Feer Disease"",""Feers Disease"",""Pink Disease"",""Swift Disease"",""Swifts Disease"",""Acrodynic Erythema"",""Chronic Childhood Mercurialism"",""Feers Disease"",""Swifts Disease"",""Erythema"","" Acrodynic"",""Childhood Mercurialism"","" Chronic"",""Childhood Mercurialisms"","" Chronic"",""Chronic Childhood Mercurialisms"",""Mercurialism"","" Chronic Childhood"
查询的SELECT部分如下所示
SELECT ?concept (replace(group_concat(replace(?label, "[\\u0022\\u0027\\u0060\\u00B4\\u2018\\u2019\\u201C\\u201D]", "");separator=","), ",", "\",\"") as ?labels)
当我使用其他替换字符时,它们在输出中不会加倍。有办法避免这种情况吗?
答案 0 :(得分:0)
我喜欢UninformedUser的解决方案。您可以在字符串周围使用单引号来避免转义:
group_concat(concat('"',?label,'"'); separator=',')