Hi,
How to delete the specified triples on the isql command line of virtuoso? These triples are stored in the file remove.nt
, and the number of triples to be deleted is 400000.
I know that SPARQL DELETE can be used to delete specified triples, but it requires manual copying of triples to the command line, which does not meet my requirements.
Virtuoso version: 07.20.3235
Best Regards
What are your requirements ?
I would presume you have graph(s) in the a Virtuoso database, from which you are seeking to delete 400K triples in the remove.nt
file ?
SPARQL DELETE would be the recommended method of deleting triples , using physical triples or triples pattern that selectivity delete a number of triples. How was the remove.nt
file generated and does it have selective patterns of triples that are to be deleted ie with a given attribute (subject, predicate, object) value or might some of the triples all be in a single graph that could be deleted with the SPARQL DROP GRAPH command ?
Thanks @hwilliams .
My requirements are as follows:
I have lots of triples in the a Virtuoso database, and want to delete 400K triples in the remove.nt file, 400K triples is a part of the database and cannot be queried through SPARQL statements.
That is to say, if I want to delete some triples in Virtuoso, I must use SPARQL or specify a small number of triples. It is not possible to delete all triples contained in the specified triples file?
There are no SPARQL specifications/methods for deleting triples based on the content of a RDF dataset file.
In Virtuoso this could possibly be achieved using isql
by:
-
Loading the remove.nt
file containing the triples to be removed into a temporary graph in Virtuoso using the RDF Bulk Loader
-
Set log_enable(3,1);
as recommended when deleting large number of triples in Virtuoso.
-
Run the following SQL query to delete the triples directly from the RDF_QUAD
table:
delete from rdf_quad a where exists (select 1 from rdf_quad b where a.s = b.s and a.p = b.p and a.o = b.o and b.g = iri_to_id('temp_graph_name') );
where temp_graph_name
is the name of the temp graph the remove.nt
triples have been loaded into.
Note, as always, before embarking on such an operation, ensure a Full Backup of the Virtuoso database is in place, should you need to revert back to the previous state.