diff options
-rwxr-xr-x | scripts/update_virtuoso/check_for_updates.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/update_virtuoso/check_for_updates.py b/scripts/update_virtuoso/check_for_updates.py index 3deed7f..81496ce 100755 --- a/scripts/update_virtuoso/check_for_updates.py +++ b/scripts/update_virtuoso/check_for_updates.py @@ -18,6 +18,9 @@ fn = sys.argv[1] user = sys.argv[2] pwd = sys.argv[3] +scriptdir = os.path.dirname(os.path.realpath(__file__)) +print(scriptdir) +basedir = os.path.dirname(os.path.dirname(scriptdir)) def upload(fn): # Upload into Virtuoso using CURL @@ -33,10 +36,6 @@ def upload(fn): print(output) assert(p.returncode == 0) -# --- Always update these -upload("semantic_enrichment/labels.ttl") -upload("semantic_enrichment/countries.ttl") - url = 'https://download.lugli.arvadosapi.com/c=lugli-4zz18-z513nlpqm03hpca/_/mergedmetadata.ttl' # --- Fetch headers from TTL file on Arvados r = requests.head(url) @@ -57,6 +56,9 @@ if os.path.isfile(fn): file.close if stamp != last_modified_str: + upload(basedir+"/semantic_enrichment/labels.ttl") + upload(basedir+"/semantic_enrichment/countries.ttl") + print("Fetch metadata TTL") r = requests.get(url) assert(r.status_code == 200) @@ -66,3 +68,5 @@ if stamp != last_modified_str: upload("metadata.ttl") with open(fn,"w") as f: f.write(last_modified_str) +else: + print("Metadata is up to date") |