From 2dddbdb2991df958699d5033b3f09f4f7367800b Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 28 Oct 2020 16:35:02 +0000 Subject: Country information --- bh20simplewebuploader/main.py | 10 ++++++---- bh20simplewebuploader/templates/list.html | 2 +- 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: PREFIX sio: - select distinct ?name ?date where + select distinct ?name ?date ?geoname where {{ ?sample <{loc}> . ?sample ?name . ?sample ?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 @@
-

{{id}}

+

{{id}}

-- cgit v1.2.3