aboutsummaryrefslogtreecommitdiff
path: root/load-rdf.scm
diff options
context:
space:
mode:
authorArun Isaac2022-06-24 15:58:26 +0530
committerArun Isaac2022-06-24 15:58:26 +0530
commit8f60fde7f5499e5ffe352d7ae98a2de34a91b89f (patch)
treeb8124504c7682629dcef25983019882f878208c2 /load-rdf.scm
parentb354c02ace3b1f722178b496cffb9a2f11921d0d (diff)
downloadgn-transform-databases-8f60fde7f5499e5ffe352d7ae98a2de34a91b89f.tar.gz
Try uploading twice into virtuoso.
* load-rdf.scm (put-graph): Accept retry? argument, and retry if it is #t. (main): Call put-graph with a #t retry? argument.
Diffstat (limited to 'load-rdf.scm')
-rwxr-xr-xload-rdf.scm13
1 files changed, 10 insertions, 3 deletions
diff --git a/load-rdf.scm b/load-rdf.scm
index f6e0f62..c390a1b 100755
--- a/load-rdf.scm
+++ b/load-rdf.scm
@@ -116,7 +116,7 @@ PROC."
(zero? return-value))
(error "Invocation of program failed" (cons program args))))))))
-(define (put-graph sparql-endpoint username password rdf-file graph)
+(define* (put-graph sparql-endpoint username password rdf-file graph #:optional retry?)
"Load RDF-FILE into GRAPH at SPARQL-ENDPOINT, a SPARQL 1.1 Graph
Store HTTP Protocol endpoint, authenticating with USERNAME and
PASSWORD. The PUT method is used, and therefore, any existing data in
@@ -134,7 +134,13 @@ the graph is deleted."
(unless (= (quotient (response-code response)
100)
2)
- (error "Putting graph failed" response))))
+ ;; When uploading a large RDF file into a clean virtuoso, it
+ ;; fails for the first time, and succeeds only the second
+ ;; time. It is unclear why. So, perform this ugly hack of trying
+ ;; twice.
+ (if retry?
+ (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."
@@ -185,7 +191,8 @@ the graph is deleted."
(assq-ref connection-settings 'virtuoso-username)
(assq-ref connection-settings 'virtuoso-password)
rdf-file
- %graph-uri)))))
+ %graph-uri
+ #t)))))
((arg0 _ ...)
(format (current-error-port) "Usage: ~a CONNECTION-SETTINGS-FILE RDF-FILE~%" arg0)
(exit #f))))