From b884492efe45b183fa0bbdd4079c77a04c98b37d Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 15 Nov 2020 20:58:30 +0100 Subject: [PATCH] modifs lozana queries and link home gif --- daapinterface.py | 59 ++++++++++++++++++++++++---------------- templates/home.html | 3 +- templates/layout.html | 3 +- templates/tutorials.html | 14 ++++------ 4 files changed, 44 insertions(+), 35 deletions(-) diff --git a/daapinterface.py b/daapinterface.py index 716a079..5714cdb 100644 --- a/daapinterface.py +++ b/daapinterface.py @@ -37,16 +37,18 @@ sparql3 = SPARQLWrapper("https://query.daap.bannerrepeater.org/proxy/wdqs/bigdat @app.route("/") def home(): sparql.setQuery(''' - SELECT ?work ?workLabel ?image ?date WHERE { - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } - ?work wdt:P1 wd:Q1. - OPTIONAL { ?work p:P30 ?statement. + SELECT ?work ?workLabel ?image ?date ?dateadded WHERE { + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } + ?work wdt:P1 wd:Q1; + wdt:P87 ?dateadded. + ?work p:P30 ?statement. ?statement ps:P30 ?image; - pq:P54 wd:Q90.} - OPTIONAL { ?work wdt:P13 ?date. } - FILTER(?work != wd:Q57) -} -ORDER BY (?workLabel) + pq:P54 wd:Q90. + ?work wdt:P13 ?date. + FILTER(?work != wd:Q57) + } + ORDER BY (?dateadded) + LIMIT 12 ''') sparql.setReturnFormat(JSON) results = sparql.query().convert() @@ -157,13 +159,17 @@ def publishersindex(): @app.route("/selfpublishedindex") def selfpublishedindex(): sparql.setQuery(''' - SELECT ?work ?workLabel ?workAltLabel ?workDescription - WHERE { - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } - ?work wdt:P1 wd:Q1; - wdt:P10 wd:Q71. - FILTER(?work != wd:Q57) - } + SELECT ?work ?workLabel ?image ?date + WHERE { + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } + ?work wdt:P1 wd:Q1; + wdt:P10 wd:Q71. + OPTIONAL {?work p:P30 ?statement. + ?statement ps:P30 ?image; + pq:P54 wd:Q90.} + OPTIONAL { ?work wdt:P13 ?date. } + FILTER(?work != wd:Q57) + } ''') sparql.setReturnFormat(JSON) results = sparql.query().convert() @@ -173,16 +179,21 @@ def selfpublishedindex(): @app.route("/zinesindex") def zinesindex(): sparql.setQuery(''' - SELECT ?work ?workLabel ?workAltLabel ?workDescription - WHERE { - SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } - ?work wdt:P1 wd:Q1; - wdt:P16 wd:Q152. - FILTER(?work != wd:Q57) - } + SELECT ?work ?workLabel ?image ?date + WHERE { + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } + ?work wdt:P1 wd:Q1; + wdt:P10 wd:Q71. + OPTIONAL {?work p:P30 ?statement. + ?statement ps:P30 ?image; + pq:P54 wd:Q90.} + OPTIONAL { ?work wdt:P13 ?date. } + FILTER(?work != wd:Q57) + } ''') sparql.setReturnFormat(JSON) results = sparql.query().convert() + print(results) return render_template('zinesindex.html', results=results) @@ -342,7 +353,7 @@ def artwork(): # text=soup.find_all("p") artworkdescriptiontext=Markup(text) - + print(artworkdescriptiontext) ############ right bottom LATER diff --git a/templates/home.html b/templates/home.html index 0fa5400..ece4e33 100644 --- a/templates/home.html +++ b/templates/home.html @@ -33,8 +33,7 @@
diff --git a/templates/layout.html b/templates/layout.html index 9a70693..80391e7 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -13,7 +13,8 @@