By default, triple deletion is performed as part of a transaction, which is stored in memory until the operation is completed and committed to the database. During typical server operation, deleting one or more graphs containing a large number of triples (generally millions or more) can consume available memory to the point where the operation cannot be completed, and thus the graph(s) cannot be deleted.
Such large graphs can be cleared by changing the transaction log mode to
autocommit on each operation, deleting the graph(s) or triples.
This is easily done using the Virtuoso
log_enable function, with the settings
This function may be called on its own, prior to the delete operation, via iSQL (either command-line or the Conductor variant), as shown:
log_enable(3,1); SPARQL CLEAR GRAPH <graph-name>;
log_enable() may also be called as a pragma specified in a SPARUL query:
SPARQL DEFINE sql:log-enable 3 CLEAR GRAPH <graph-name>;
Triples can also be deleted directly from the
RDF_QUAD table via SQL, but note that this method will not remove any free-text index data that might be associated with the graph, which
CLEAR GRAPH ... would do automatically.
The SQL operation would look something like this:
log_enable(3,1); DELETE FROM rdf_quad WHERE g = iri_to_id ('http://mygraph.org');