<docbook><section><title>VirtTipsAndTricksGuideClearGraphsRelEmptyGraphs</title><bridgehead class="http://www.w3.org/1999/xhtml:h2">How to clear graphs which are related to empty graphs?</bridgehead>
<para>The following example demonstrates how to remove graphs which are related to empty graphs:</para>
<programlisting>PREFIX nrl:&lt;http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#&gt;
SELECT ( bif:exec(bif:sprintf(&quot;SPARQL CLEAR GRAPH&lt;%s&gt;&quot;, str(?mg))))
WHERE 
  {
    ?mg nrl:coreGraphMetadataFor ?g .
    FILTER(?g in ( &lt;urn:nepomuk:local:8a9e692a&gt; )) .
    FILTER ( !bif:exists((SELECT (1) WHERE { GRAPH ?g { ?s ?p ?o . } . })) ) .
  }
</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>
</itemizedlist></section></docbook>