|
|
@ -136,47 +136,49 @@ def browsebycategory(): |
|
|
|
@app.route("/artistsindex") |
|
|
|
def artistsindex(): |
|
|
|
sparql.setQuery(''' |
|
|
|
SELECT ?creators ?creatorsLabel ?creatorsAltLabel ?creatorsDescription |
|
|
|
WHERE { |
|
|
|
SELECT ?creators ?creatorsLabel ?creatorsAltLabel ?creatorsDescription WHERE { |
|
|
|
{ |
|
|
|
SELECT ?creators (COUNT(DISTINCT ?a) AS ?count) WHERE { |
|
|
|
?a ?prop ?creators . |
|
|
|
?a wdt:P1 ?work . |
|
|
|
BIND (wdt:P9 AS ?prop) . |
|
|
|
BIND (wd:Q1 AS ?work) . |
|
|
|
} GROUP BY ?creators |
|
|
|
SELECT ?creators (COUNT(DISTINCT ?a) AS ?count) WHERE { |
|
|
|
?a ?prop ?creators . |
|
|
|
?a wdt:P1 ?work . |
|
|
|
BIND (wdt:P9 AS ?prop) . |
|
|
|
BIND (wd:Q1 AS ?work) . |
|
|
|
} GROUP BY ?creators |
|
|
|
} . |
|
|
|
SERVICE wikibase:label { |
|
|
|
bd:serviceParam wikibase:language "en" . |
|
|
|
bd:serviceParam wikibase:language "en" . |
|
|
|
} |
|
|
|
FILTER (?creators !=wd:Q82) |
|
|
|
} |
|
|
|
ORDER BY DESC(?count) ?creatorsLabel |
|
|
|
} |
|
|
|
ORDER BY ?creatorsLabel |
|
|
|
''') |
|
|
|
sparql.setReturnFormat(JSON) |
|
|
|
results = sparql.query().convert() |
|
|
|
print(results) |
|
|
|
return render_template('artistsindex.html', results=results) |
|
|
|
|
|
|
|
######################### PUBLISHERS INDEX |
|
|
|
@app.route("/publishersindex") |
|
|
|
def publishersindex(): |
|
|
|
sparql.setQuery(''' |
|
|
|
SELECT ?publishers ?publishersLabel ?publishersAltLabel ?publishersDescription WHERE { |
|
|
|
{ |
|
|
|
SELECT ?publishers (COUNT(DISTINCT ?a) AS ?count) WHERE { |
|
|
|
?a ?prop ?publishers . |
|
|
|
?a wdt:P1 ?work . |
|
|
|
BIND (wdt:P10 AS ?prop) . |
|
|
|
BIND (wd:Q1 AS ?work) . |
|
|
|
} GROUP BY ?publishers |
|
|
|
} . |
|
|
|
SERVICE wikibase:label { |
|
|
|
bd:serviceParam wikibase:language "en" . |
|
|
|
} |
|
|
|
FILTER(?publishers != wd:Q83) |
|
|
|
FILTER(?publishers != wd:Q71) |
|
|
|
} |
|
|
|
ORDER BY DESC(?count) ?publishersLabel |
|
|
|
SELECT ?publishers ?publishersLabel ?publishersAltLabel ?publishersDescription WHERE { |
|
|
|
{ |
|
|
|
SELECT ?publishers (COUNT(DISTINCT ?a) AS ?count) WHERE { |
|
|
|
?a ?prop ?publishers . |
|
|
|
?a wdt:P1 ?work . |
|
|
|
?publishers wdt:P1 ?typeofpublisher. |
|
|
|
BIND (wdt:P10 AS ?prop) . |
|
|
|
BIND (wd:Q1 AS ?work) |
|
|
|
BIND (wd:Q12 AS ?typeofpublisher). |
|
|
|
} GROUP BY ?publishers |
|
|
|
} . |
|
|
|
SERVICE wikibase:label { |
|
|
|
bd:serviceParam wikibase:language "en" . |
|
|
|
} |
|
|
|
FILTER(?publishers != wd:Q83) |
|
|
|
FILTER(?publishers != wd:Q71) |
|
|
|
} |
|
|
|
ORDER BY DESC(?count) ?publishersLabel |
|
|
|
''') |
|
|
|
sparql.setReturnFormat(JSON) |
|
|
|
results = sparql.query().convert() |
|
|
|