aboutsummaryrefslogtreecommitdiff
path: root/load-rdf.scm
diff options
context:
space:
mode:
authorArun Isaac2022-10-21 14:13:56 +0530
committerArun Isaac2022-10-21 17:06:39 +0530
commit20734088eef70a623e5fd62530bb3efd7deb8fa8 (patch)
tree6532ff547942b937c3eb706878e8d24c594572cf /load-rdf.scm
parent8ff50fe6b48d9855c887b718547a8d4802e6ccba (diff)
downloadgn-transform-databases-20734088eef70a623e5fd62530bb3efd7deb8fa8.tar.gz
Authenticate when deleting graph from virtuoso.
* load-rdf.scm (delete-graph): Accept password argument. (main): Call delete-graph with password.
Diffstat (limited to 'load-rdf.scm')
-rwxr-xr-xload-rdf.scm18
1 files 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)