From 20734088eef70a623e5fd62530bb3efd7deb8fa8 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 21 Oct 2022 14:13:56 +0530 Subject: Authenticate when deleting graph from virtuoso. * load-rdf.scm (delete-graph): Accept password argument. (main): Call delete-graph with password. --- load-rdf.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/load-rdf.scm b/load-rdf.scm index c390a1b..4cd7841 100755 --- a/load-rdf.scm +++ b/load-rdf.scm @@ -142,19 +142,24 @@ the graph is deleted." (put-graph sparql-endpoint username password rdf-file graph #f) (error "Putting graph failed" response))))) -(define (delete-graph port graph) - "Delete GRAPH from virtuoso connecting to virtuoso on PORT." +(define (delete-graph port password graph) + "Delete GRAPH from virtuoso connecting to virtuoso on PORT +authenticating as the dba user with PASSWORD." ;; We do this with SQL because doing it with SPARQL is too ;; slow. Note that this does not delete free-text index data, if ;; any. See ;; http://vos.openlinksw.com/owiki/wiki/VOS/VirtTipsAndTricksGuideDeleteLargeGraphs (call-with-pipe - (lambda (port) - (format port - "DELETE FROM rdf_quad WHERE g = iri_to_id ('~a');" + (lambda (out) + (format out + "SET DSN=localhost:~a; +SET PWD=~a; +DELETE FROM rdf_quad WHERE g = iri_to_id ('~a');" + port + password graph)) OPEN_WRITE - "isql" "-S" (number->string port))) + "isql")) (define (time-thunk thunk) "Run THUNK and return the time taken in seconds." @@ -176,6 +181,7 @@ the graph is deleted." (time-thunk (cut delete-graph (assq-ref connection-settings 'virtuoso-port) + (assq-ref connection-settings 'virtuoso-password) %graph-uri))) ;; Load data into virtuoso. (format (current-output-port) -- cgit v1.2.3