<docbook><section><title>VirtTipsAndTricksControlConvertPropertiesToString</title><title>How to construct query to change all the values of properties in a triple to strings?</title>How to construct query to change all the values of properties in a triple to strings?
<para>Suppose for given graph all values of properties are a mixture of strings and decimals.</para>
<programlisting>SELECT DISTINCT ?sa ?oa 
FROM &lt;http://ucb.com/nbeabase&gt;
WHERE 
  { 
    ?sa a &lt;http://ucb.com/nbeabase/resource/Batch&gt; .
    ?sa &lt;http://ucb.com/nbeabase/resource/chemAbsNo&gt; ?oa . FILTER regex(?oa, &#39;-&#39;,&#39;i&#39;)
  }
</programlisting><para> In order to change the values to string, should be executed the following statement:</para>
<programlisting>SQL&gt; SPARQL 
INSERT INTO GRAPH &lt;http://ucb.com/nbeabase&gt; 
  { 
    ?sa &lt;http://ucb.com/nbeabase/resource/sampleId&gt; `str (?oa)` 
  }  
WHERE 
  { 
    ?sa &lt;http://ucb.com/nbeabase/resource/chemAbsNo&gt; ?oa .  FILTER regex(?oa, &#39;-&#39;,&#39;i&#39;)   
  }
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfandsparql.html">RDF Data Access and Data Management</ulink> </listitem>
</itemizedlist></section></docbook>