aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPjotr Prins2020-05-12 14:11:31 -0500
committerPjotr Prins2020-05-12 14:11:31 -0500
commit5348517df7f62ce81d33e388f70e97cba680f679 (patch)
tree42d5966b81904149ba9dff6f74e7dc31624bb147 /scripts
parent8e9042879db7fe061f3d18737f4102b5fd0b8c65 (diff)
downloadbh20-seq-resource-5348517df7f62ce81d33e388f70e97cba680f679.tar.gz
bh20-seq-resource-5348517df7f62ce81d33e388f70e97cba680f679.tar.lz
bh20-seq-resource-5348517df7f62ce81d33e388f70e97cba680f679.zip
Update graph script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update_virtuoso/check_for_updates.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/scripts/update_virtuoso/check_for_updates.py b/scripts/update_virtuoso/check_for_updates.py
index f3b8a86..1c7813a 100755
--- a/scripts/update_virtuoso/check_for_updates.py
+++ b/scripts/update_virtuoso/check_for_updates.py
@@ -10,6 +10,25 @@
import requests
import time
+def upload(fn):
+ # Upload into Virtuoso using CURL
+ # cmd = "curl -X PUT --digest -u dba:dba -H Content-Type:text/turtle -T metadata.ttl -G http://localhost:8890/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph".split(" ")
+ print("DELETE "+fn)
+ cmd = ("curl --digest --user dba:dba --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(cmd)
+ p = subprocess.Popen(cmd)
+ output = p.communicate()[0]
+ print(output)
+ assert(p.returncode == 0)
+
+ 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" % pwd, fn ).split(" ")
+ print(cmd)
+ p = subprocess.Popen(cmd)
+ output = p.communicate()[0]
+ print(output)
+ assert(p.returncode == 0)
+
url = 'https://download.lugli.arvadosapi.com/c=lugli-4zz18-z513nlpqm03hpca/_/mergedmetadata.ttl'
# --- Fetch headers from TTL file on Arvados
r = requests.head(url)
@@ -45,15 +64,9 @@ if stamp != last_modified_str:
with open("metadata.ttl", "w") as f:
f.write(r.text)
f.close
- # Now push into Virtuoso using CURL
- # cmd = "curl -X PUT --digest -u dba:dba -H Content-Type:text/turtle -T metadata.ttl -G http://localhost:8890/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph".split(" ")
- print("Push metadata TTL")
- cmd = ("curl -X PUT --digest -u dba:%s -H Content-Type:text/turtle -T metadata.ttl -G http://sparql.genenetwork.org/sparql-graph-crud-auth --data-urlencode graph=http://covid-19.genenetwork.org/graph" % pwd ).split(" ")
- print(cmd)
- p = subprocess.Popen(cmd)
- output = p.communicate()[0]
- print(output)
- assert(p.returncode == 0)
+ upload("metadata.ttl")
+ upload("semantic_enrichment/labels.ttl")
+ upload("semantic_enrichment/countries.ttl")
with open(fn,"w") as f:
f.write(last_modified_str)