about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2020-10-28 16:35:02 +0000
committerPjotr Prins2020-10-28 16:35:02 +0000
commit2dddbdb2991df958699d5033b3f09f4f7367800b (patch)
tree91c2870bd0cca52d0471a8cabc77efc796f6eade
parente9ea11c5332668af16c0497bf2b578433b05b32f (diff)
downloadbh20-seq-resource-2dddbdb2991df958699d5033b3f09f4f7367800b.tar.gz
bh20-seq-resource-2dddbdb2991df958699d5033b3f09f4f7367800b.tar.lz
bh20-seq-resource-2dddbdb2991df958699d5033b3f09f4f7367800b.zip
Country information
-rw-r--r--bh20simplewebuploader/main.py10
-rw-r--r--bh20simplewebuploader/templates/list.html2
2 files changed, 7 insertions, 5 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 0be9d9f..73503b4 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -724,22 +724,24 @@ def location():
     """Show country resource"""
     loc = request.args.get('label')
     logging.info(loc)
-    logging.info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
+    # logging.info("^^^^^^^^^^^^^^^^^^^^^^^^^^^^")
     query = f"""
     PREFIX pubseq: <http://biohackathon.org/bh20-seq-schema#MainSchema/>
     PREFIX sio: <http://semanticscience.org/resource/>
-    select distinct ?name ?date where
+    select distinct ?name ?date ?geoname where
     {{
       ?sample <http://purl.obolibrary.org/obo/GAZ_00000448> <{loc}> .
       ?sample <http://semanticscience.org/resource/SIO_000115> ?name .
       ?sample <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C25164> ?date .
+      <{loc}> rdfs:label ?geoname .
     }} order by ?name
     """
     payload = {'query': query, 'format': 'json'}
     r = requests.get(sparqlURL, params=payload)
     result = r.json()['results']['bindings']
-    logging.info(result)
-    return render_template('list.html',id=loc,menu='',h=['name','date'],l=result)
+    geoname = result[0]['geoname']['value']
+    # logging.info(result)
+    return render_template('list.html',id=geoname,url=loc,menu='',h=['name','date'],l=result)
 
 ## Dynamic API functions starting here
 ## This is quick and dirty for now, just to get something out and demonstrate the queries
diff --git a/bh20simplewebuploader/templates/list.html b/bh20simplewebuploader/templates/list.html
index d50a045..5eacf1b 100644
--- a/bh20simplewebuploader/templates/list.html
+++ b/bh20simplewebuploader/templates/list.html
@@ -7,7 +7,7 @@
 
     <hr>
 
-    <h1>{{id}}</h1>
+    <h1><a href="{{url}}">{{id}}</a></h1>
 
     <div class="content">
     <section class="blog-entries">