From 90baeb04aabf8d3004709fc7c5b4cc710c47fd0f Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 15 Jun 2020 09:52:18 -0500 Subject: virtuoso: remove graph before update --- scripts/update_virtuoso/check_for_updates.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/update_virtuoso/check_for_updates.py b/scripts/update_virtuoso/check_for_updates.py index 81496ce..d5eee14 100755 --- a/scripts/update_virtuoso/check_for_updates.py +++ b/scripts/update_virtuoso/check_for_updates.py @@ -29,7 +29,7 @@ def upload(fn): # cmd = ("curl --digest --user dba:%s --verbose --url -G http://sparql.genenetwork.org/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph -X DELETE" % pwd).split(" ") print("UPLOAD "+fn) - cmd = ("curl -X PUT --digest -u dba:%s -H Content-Type:text/turtle -T %s -G http://sparql.genenetwork.org/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph/%s" % (pwd, fn, fn) ).split(" ") + cmd = ("curl -X PUT --digest -u dba:%s -H Content-Type:text/turtle -T %s -G http://sparql.genenetwork.org/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph/%s" % (pwd, fn, os.path.basename(fn)) ).split(" ") print(cmd) p = subprocess.Popen(cmd) output = p.communicate()[0] @@ -56,6 +56,15 @@ if os.path.isfile(fn): file.close if stamp != last_modified_str: + print("Delete graphs") + for graph in ["labels.ttl", "metadata.ttl", "countries.ttl" ""]: + cmd = ("curl --digest -u dba:%s --verbose --url http://127.0.0.1:8890/sparql-graph-crud-auth?graph=http://covid-19.genenetwork.org/graph/%s -X DELETE" % (pwd, graph)) + print(cmd) + p = subprocess.Popen(cmd.split(" ")) + output = p.communicate()[0] + print(output) + # assert(p.returncode == 0) -> may prevent update + upload(basedir+"/semantic_enrichment/labels.ttl") upload(basedir+"/semantic_enrichment/countries.ttl") -- cgit v1.2.3