Virtuoso SPARQL 1.1. DROP Usage Examples
What?
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.Why?
Use to remove a named graph from the RDF Quad Store.How?
Here are some examples showcasing Virtuoso's support for this functionality:
DROP Example
This example drops named graph identified by the IRI <urn:sparql:tests:drop:data> from the RDF Quad Store.
- Assume the following Raw Data Representation in Turtle:
<#book1> <#price> 41 . <#book2> <#price> 42 . <#book3> <#price> 43 . <#book4> <#price> 44 .
- Create explicitly a named graph with IRI <urn:sparql:tests:drop:data> :
CREATE GRAPH <urn:sparql:tests:drop:data>;
- Load the sample data:
INSERT DATA { GRAPH <urn:sparql:tests:drop:data> { <#book1> <#price> 41 . <#book2> <#price> 42 . <#book3> <#price> 43 . <#book4> <#price> 44 . } }
- Query graph <urn:sparql:tests:drop:data> data -- should return 4 triples:
SELECT * FROM <urn:sparql:tests:drop:data> WHERE { ?s ?p ?o }
- Drop the named graph identified by the IRI <urn:sparql:tests:drop:data> :
DROP GRAPH <urn:sparql:tests:drop:data>;
- 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 useSILENT
option, which will not signal any errors:
DROP SILENT GRAPH <urn:sparql:tests:drop:data>;
- Note: If the graph is not created explicitly as per above, i.e.
the step
- Query graph <urn:sparql:tests:drop:data> data -- should return no triples:
SELECT * FROM <urn:sparql:tests:drop:data> WHERE { ?s ?p ?o }
Related
- SPARQL 1.1 DROP
- Rename RDF Graph Example
- SPARQL Protocol (HTTP based Query Service)
- Virtuoso Tips and Tricks Collection
- Virtuoso SPARQL 1.1 Usage Examples Collection
- Virtuoso SPARQL 1.1 Syntax Tutorial
- Virtuoso Documentation