2016-03-22 9 views
2

組み込みのSPARQL関数を使用して文字列を分割することはできますか?SPARQLクエリをケース別に分割

例えば

は、「すべての薬」を返す機能を使用することは可能です以下の試験AllDrugsを取りますか?

答えて

5

あなたはたったの$ 1 $ 2(ここで、$ 1小文字と$ 2は大文字です)でパターン([AZ])([AZ])を交換する必要があり、確かに。ここでは例です:

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

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

muchasグラシアス! –