. . . . "09190f0d706b2ea107278c77aac8a874" . "2017-06-13T05:48:32.773919"^^ . . . "2017-06-13T05:48:32.773919"^^ . . . . . . "VirtTipsAndTricksDeleteGraphProc" . "%META:TOPICPARENT{name=\"VirtTipsAndTricksGuide\"}%\n\n---+How can I delete graphs using stored procedure?\n\n\nThe following script demonstrates the use of custom stored procedures for deleting graph(s). It first creates a table GRAPHS_TO_DELETE, into which the names of the graphs to be deleted should be inserted, as follows:\n\n\nuse MYUSR;\n\ncreate procedure GRAPHS_TO_DELETE_SP (in gd_iris any)\n{\n declare gd_iri iri_id;\n declare dp, row any;\n result_names (gd_iri);\n dp := dpipe (0, '__I2IDN');\n foreach (varchar iri in GD_IRIS) do\n {\n dpipe_input (dp, iri);\n }\n while (0 <> (row := dpipe_next (dp, 0)))\n {\n result (row[0]);\n }\n}\n;\n\ndrop view GRAPHS_TO_DELETE_VIEW;\ncreate procedure view GRAPHS_TO_DELETE_VIEW as MYUSR.DBA.GRAPHS_TO_DELETE_SP (gd_iris) (gd_iri any);\n\ncreate procedure DELETE_GRAPHS (in g_iris any)\n{\n declare g_iids any;\n if (not isvector (g_iris) and g_iris is not null)\n signal ('22023', '.....', 'The input argument must be an array of strings or null');\n if (not length (g_iris))\n return 0;\n delete from DB.DBA.RDF_QUAD where G in (select * from GRAPHS_TO_DELETE_VIEW where gd_iris = g_iris) option (loop exists);\n return row_count ();\n}\n;\n\n\nFinally call the procedure DELETE_GRAPHS to perform the deletion of the specified graphs. Note it does not return a result set and can be called as follows:\n\n\nSQL> select MYUSR.DBA.DELETE_GRAPHS (vector ('g1', 'g2', 'g3'));\n\n\nThis will return the number of triples removed from the specified graphs. \n\n\nNote: the procedure only applies to the cluster so to get IRI IDs via partitioned pipe (DAQ). It is not usable on single.\n\n\n---+++Related\n \n * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]\n * [[http://docs.openlinksw.com/virtuoso/sparqlextensions.html#rdfsparulexamples14][How can I delete triples from a graph?]]" . "2017-06-13T05:48:32Z" . "2017-06-13T05:48:32Z" . . . . "VirtTipsAndTricksDeleteGraphProc" . . "VirtTipsAndTricksDeleteGraphProc" .