<docbook><section><title>VirtTipsAndTricksGuideRenameGraph</title><bridgehead class="http://www.w3.org/1999/xhtml:h2">How to rename a RDF Graph in the Virtuoso Quad Store</bridgehead>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Rename RDF Graph</bridgehead>
 A RDF Graph in the Virtuoso Quad Store can be renamed without copying each assertion from the old graph to the new graph using a SQL statement, this being what the Conductor &quot;rename&quot; option does, which is:<programlisting>UPDATE DB.DBA.RDF_QUAD TABLE OPTION (index RDF_QUAD_GS) 
   SET g = iri_to_id (&#39;new&#39;) 
 WHERE g = iri_to_id (&#39;old&#39;, 0);  
</programlisting><para> <emphasis>Note</emphasis>: this operation must be run in <emphasis>row-autocommit</emphasis> mode i.e.
 log_enable (3), and then restore back to the default logging mode of 1.</para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Rename RDF Graph Group</bridgehead>
<para>For Virtuoso Graph Groups two tables need to be updated:</para>
<programlisting>UPDATE DB.DBA.RDF_GRAPH_GROUP_MEMBER 
   SET RGGM_GROUP_IID = iri_to_id (&#39;new&#39;) 
 WHERE RGGM_GROUP_IID = iri_to_id (old)
</programlisting><para> and</para>
<programlisting>UPDATE DB.DBA.RDF_GRAPH_GROUP 
   SET RGG_IID = iri_to_id (&#39;new&#39;) , RGG_IRI = &#39;new&#39; 
 WHERE RGG_IRI = &#39;old&#39;  
</programlisting><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/rdfperformancetuning.html">RDF Performance Tuning</ulink> </listitem>
</itemizedlist></section></docbook>