title: SPARQL 1.1: how to use the replace function?
body: <p>How can one use the replace function in SPARQL 1.1, especially in update commands?</p>
  
  <p>For example, if I have a number of triples ?s ?p ?o where ?o is a string and for all triples where ?o contains the string "gotit" I want to insert an additional triple where "gotit" is replaced by "haveit", how could I do this? I am trying to achieve this is Sesame 2.6.0.</p>
  
  <p>I tried this naive approach:</p>
  
  <pre><code>INSERT { ?s ?p replace(?o,"gotit","haveit","i") . }
  WHERE { ?s ?p ?o . FILTER(regex(?o,"gotit","i")) }
  </code></pre>
  
  <p>but this caused a syntax error.</p>
  
  <p>I also failed to use replace in the result list of a query like so:</p>
  
  <pre><code>SELECT ?s ?p (replace(?o,"gotit","haveit","i") as ?r) WHERE { .... }
  </code></pre>
  
  <p>The SPARQL document unfortunately does not contain an example of how to use this function.</p>
  
  <p>Is it possible at all to use functions to create new values and not just test existing values and if yes, how?</p>