<docbook><section><title>VirtTipsAndTricksGuideModifyUsageAsInsert</title><para> </para>
<title>How Can I Use MODIFY to update triples?</title>How Can I Use MODIFY to update triples?
<para> The following queries are equivalent:</para>
<programlisting>MODIFY &lt;http://test.com/&gt;
DELETE {?s ?p ?o}
INSERT {?s_new ?p ?o}
FROM &lt;http://test.com/&gt;
WHERE
{
  {
    SELECT iri(bif:replace(str(?s),&quot;http://test.com/link&quot;,&quot;http://test.com/extra/link&quot; ) )
      AS ?s_new ?s ?p ?o
    WHERE 
      {
        ?s ?p ?o FILTER (regex (str(?s), &quot;http://test.com/link&quot;))
      }
  }
}
</programlisting><programlisting>MODIFY &lt;http://test.com/&gt;
DELETE {?s ?p ?o}
INSERT {`iri(?s_new)` ?p ?o}
FROM &lt;http://test.com/&gt;
WHERE 
  {
    {
      SELECT bif:replace(str(?s),&quot;http://test.com/link&quot;,&quot;http://test.com/extra/link&quot; )
        AS ?s_new ?s ?p ?o
      WHERE 
        {
          ?s ?p ?o FILTER (regex (str(?s), &quot;http://test.com/link&quot;))
        }
    }
  }

</programlisting><para> </para>
<programlisting>MODIFY &lt;http://test.com/&gt;
DELETE {?s ?p ?o}
INSERT
  { `iri(bif:replace(str(?s),&quot;http://test.com/link&quot;,&quot;http://test.com/extra/link&quot; ))`  ?p ?o }
FROM &lt;http://test.com/&gt;  
WHERE
  {
    {
      ?s ?p ?o FILTER (regex (str(?s), &quot;http://test.com/link&quot;))
    }
  }
}
</programlisting><bridgehead class="http://www.w3.org/1999/xhtml:h2">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/rdfsparql.html">Virtuoso Documentation</ulink> </listitem>
</itemizedlist></section></docbook>