<docbook><section><title>VirtTipsAndTricksSPARQL11Drop</title><title>Virtuoso SPARQL 1.1.
 DROP Usage Examples</title>Virtuoso SPARQL 1.1.
 DROP Usage Examples
<bridgehead class="http://www.w3.org/1999/xhtml:h2">What?</bridgehead>
 This guide contains Virtuoso SPARQL 1.1.
 DROP Usage examples queries which you can run against any SPARQL endpoint that supports SPARQL 1.1 and the ability to allow a verified user perform INSERT operations.<bridgehead class="http://www.w3.org/1999/xhtml:h2">Why?</bridgehead>
 Use to remove a named graph from the RDF Quad Store.<bridgehead class="http://www.w3.org/1999/xhtml:h2">How?</bridgehead>
<para>Here are some examples showcasing Virtuoso&#39;s support for this functionality:</para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">DROP Example</bridgehead>
<para>This example drops named graph identified by the IRI &lt;urn:sparql:tests:drop:data&gt; from the RDF Quad Store.</para>
<orderedlist spacing="compact"><listitem>Assume the following Raw Data Representation in Turtle: <programlisting>&lt;#book1&gt; &lt;#price&gt; 41 .
&lt;#book2&gt; &lt;#price&gt; 42 .
&lt;#book3&gt; &lt;#price&gt; 43 .
&lt;#book4&gt; &lt;#price&gt; 44 .
</programlisting></listitem>
<listitem>Create explicitly a named graph with IRI &lt;urn:sparql:tests:drop:data&gt; : <programlisting>CREATE GRAPH &lt;urn:sparql:tests:drop:data&gt;;
</programlisting></listitem>
<listitem>Load the sample data: <programlisting>INSERT DATA
  { 
    GRAPH &lt;urn:sparql:tests:drop:data&gt; 
      { 
        &lt;#book1&gt; &lt;#price&gt; 41 . 
        &lt;#book2&gt; &lt;#price&gt; 42 . 
        &lt;#book3&gt; &lt;#price&gt; 43 . 
        &lt;#book4&gt; &lt;#price&gt; 44 .  
      } 
  }
</programlisting></listitem>
<listitem>Query graph &lt;urn:sparql:tests:drop:data&gt; data -- should return 4 triples: <programlisting>SELECT * 
FROM &lt;urn:sparql:tests:drop:data&gt; 
WHERE 
  {
    ?s ?p ?o
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/10scyxi">View the SPARQL Query Definition via SPARQL Protocol URL</ulink>; </listitem>
<listitem><ulink url="http://bit.ly/X8qXRI">View the SPARQL Query Results via SPARQL Protocol URL</ulink> </listitem>
</itemizedlist></listitem>
<listitem>Drop the named graph identified by the IRI &lt;urn:sparql:tests:drop:data&gt; : <programlisting>DROP GRAPH &lt;urn:sparql:tests:drop:data&gt;;
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem>Note: If the graph is not created explicitly as per above, i.e.
 the step CREATE GRAPH .. is omitted, in order to drop the graph you need to use SILENT option, which will not signal any errors: <programlisting>DROP SILENT GRAPH &lt;urn:sparql:tests:drop:data&gt;;
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>Query graph &lt;urn:sparql:tests:drop:data&gt; data -- should return no triples: <programlisting>SELECT * 
FROM &lt;urn:sparql:tests:drop:data&gt; 
WHERE 
  {
    ?s ?p ?o
  }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/10scyxi">View the SPARQL Query Definition via SPARQL Protocol URL</ulink>; </listitem>
<listitem><ulink url="http://bit.ly/X8qXRI">View the SPARQL Query Results via SPARQL Protocol URL</ulink></listitem>
</itemizedlist></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://www.w3.org/TR/2012/PR-sparql11-update-20121108/#drop">SPARQL 1.1 DROP</ulink> </listitem>
<listitem><ulink url="VirtTipsAndTricksGuideRenameGraph">Rename RDF Graph Example</ulink> </listitem>
<listitem><ulink url="http://www.w3.org/TR/rdf-sparql-protocol/">SPARQL Protocol (HTTP based Query Service)</ulink> </listitem>
<listitem><ulink url="VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink> </listitem>
<listitem><ulink url="VirtTipsAndTricksSPARQL11FeaturesExamplesCollection">Virtuoso SPARQL 1.1 Usage Examples Collection</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/tutorials/sparql/SPARQL_Tutorials_Part_9/SPARQL_Tutorials_Part_9.html">Virtuoso SPARQL 1.1 Syntax Tutorial</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html">Virtuoso Documentation</ulink></listitem>
</itemizedlist></section></docbook>