SPARQL查询按案例分割

Imr*_*zad 2 sparql

是否可以使用内置的SPARQL函数按字符串拆分字符串?

例如,参加以下测试AllDrugs

可以使用一个会返回"All Drugs"的功能吗?

Jos*_*lor 6

当然,你只需要更换的模式(即[az])([AZ])$ 1 $ 2(其中$ 1是小写字母和$ 2是大写字母).这是一个例子:

select * where {
  values ?string { "AllDrugs" "FourScoreAndSevenYearsAgo" }

  bind(replace(?string, "([a-z])([A-Z])", "$1 $2") as ?splitString)
}
Run Code Online (Sandbox Code Playgroud)
------------------------------------------------------------------
| string                      | splitString                      |
==================================================================
| "AllDrugs"                  | "All Drugs"                      |
| "FourScoreAndSevenYearsAgo" | "Four Score And Seven Years Ago" |
------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)