Removing all triples from a Virtuoso Server instance
There are times it can be useful to remove all triples from Virtuoso Server. There are a few ways to accomplish this.
Remove all triples including those in the the system graphs
Use iSQL, either on the command-line or through the Virtuoso Conductor -> Database -> Interactive SQL, to execute this SQL query --
SQL> DELETE FROM DB.DBA.RDF_QUAD ;
Remove all triples except those in the system graphs
Use the built-in RDF_GLOBAL_RESET procedure
- Use iSQL, either on the command-line or through the Virtuoso Conductor -> Database -> Interactive SQL, to execute this SQL query --
SQL> RDF_GLOBAL_RESET ();
- Now selecting all graphs from your db should return only the system graphs, like so --
SQL> SPARQL SELECT DISTINCT ?g FROM <http://localhost:8894/> { GRAPH ?g { ?s a ?t } } ; g ANY http://www.openlinksw.com/schemas/virtrdf# No. of rows in result: 1
Write your own procedure
Take all non-system graphs, and for each of them execute:
SPARQL CLEAR GRAPH <The Graph URI here> ;