Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In the first <a href="http://www.w3.org/TR/rdf-sparql-query/" rel="noreferrer">SPARQL Query Language for RDF</a>, this would be rather difficult, because there are not many string manipulation functions. However, in your question, you've used <a href="http://www.w3.org/TR/sparql11-query/#func-replace" rel="noreferrer"><code>replace</code></a> which appeared in <a href="http://www.w3.org/TR/sparql11-query/" rel="noreferrer">SPARQL 1.1 Query Language</a>. This is good for you because, in addition to <code>replace</code>, SPARQL 1.1 includes more string manipulation functions. One of these, <a href="http://www.w3.org/TR/sparql11-query/#func-substr" rel="noreferrer"><code>substr</code></a>, does exactly what you need. For instance, here's a query in which <code>?string</code> is bound to the string you mentioned, and <code>substr</code> is used to extract the substring you're looking for and bind it as <code>?substring</code>.</p> <pre><code>select * where { values ?string { "OEIUFHWOIEFWNFOPQWJFHQWOIHFEB..." } bind( substr( ?string, 5, 6 ) as ?substring ) } </code></pre> <p>The results are:</p> <pre><code>-------------------------------------------------- | string | substring | ================================================== | "OEIUFHWOIEFWNFOPQWJFHQWOIHFEB..." | "FHWOIE" | -------------------------------------------------- </code></pre> <p>Note that the second argument to <code>substr</code> is the starting position (where the first index is 1), and the third is the <em>length</em> of the substring, not the final position. You wanted a substring, <code>FHWOIE</code>, that has six characters, to the third argument is 6.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload