aboutsummaryrefslogtreecommitdiff
path: root/scripts/update_virtuoso/check_for_updates.py
diff options
context:
space:
mode:
authorPjotr Prins2020-06-15 09:52:18 -0500
committerPjotr Prins2020-06-15 09:52:18 -0500
commit90baeb04aabf8d3004709fc7c5b4cc710c47fd0f (patch)
tree76b68165fcdfd0f957c3c1be2a88d4015ee42360 /scripts/update_virtuoso/check_for_updates.py
parentd18005b1880692cab16ecfc9e0c950abc4259087 (diff)
downloadbh20-seq-resource-90baeb04aabf8d3004709fc7c5b4cc710c47fd0f.tar.gz
bh20-seq-resource-90baeb04aabf8d3004709fc7c5b4cc710c47fd0f.tar.lz
bh20-seq-resource-90baeb04aabf8d3004709fc7c5b4cc710c47fd0f.zip
virtuoso: remove graph before update
Diffstat (limited to 'scripts/update_virtuoso/check_for_updates.py')
-rwxr-xr-xscripts/update_virtuoso/check_for_updates.py11
1 files changed, 10 insertions, 1 deletions
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")