semi colon item and queries browse publisher artist
This commit is contained in:
parent
12102370f8
commit
9ad1f24863
@ -136,47 +136,49 @@ def browsebycategory():
|
|||||||
@app.route("/artistsindex")
|
@app.route("/artistsindex")
|
||||||
def artistsindex():
|
def artistsindex():
|
||||||
sparql.setQuery('''
|
sparql.setQuery('''
|
||||||
SELECT ?creators ?creatorsLabel ?creatorsAltLabel ?creatorsDescription
|
SELECT ?creators ?creatorsLabel ?creatorsAltLabel ?creatorsDescription WHERE {
|
||||||
WHERE {
|
|
||||||
{
|
{
|
||||||
SELECT ?creators (COUNT(DISTINCT ?a) AS ?count) WHERE {
|
SELECT ?creators (COUNT(DISTINCT ?a) AS ?count) WHERE {
|
||||||
?a ?prop ?creators .
|
?a ?prop ?creators .
|
||||||
?a wdt:P1 ?work .
|
?a wdt:P1 ?work .
|
||||||
BIND (wdt:P9 AS ?prop) .
|
BIND (wdt:P9 AS ?prop) .
|
||||||
BIND (wd:Q1 AS ?work) .
|
BIND (wd:Q1 AS ?work) .
|
||||||
} GROUP BY ?creators
|
} GROUP BY ?creators
|
||||||
} .
|
} .
|
||||||
SERVICE wikibase:label {
|
SERVICE wikibase:label {
|
||||||
bd:serviceParam wikibase:language "en" .
|
bd:serviceParam wikibase:language "en" .
|
||||||
}
|
}
|
||||||
FILTER (?creators !=wd:Q82)
|
FILTER (?creators !=wd:Q82)
|
||||||
}
|
}
|
||||||
ORDER BY DESC(?count) ?creatorsLabel
|
ORDER BY ?creatorsLabel
|
||||||
''')
|
''')
|
||||||
sparql.setReturnFormat(JSON)
|
sparql.setReturnFormat(JSON)
|
||||||
results = sparql.query().convert()
|
results = sparql.query().convert()
|
||||||
|
print(results)
|
||||||
return render_template('artistsindex.html', results=results)
|
return render_template('artistsindex.html', results=results)
|
||||||
|
|
||||||
######################### PUBLISHERS INDEX
|
######################### PUBLISHERS INDEX
|
||||||
@app.route("/publishersindex")
|
@app.route("/publishersindex")
|
||||||
def publishersindex():
|
def publishersindex():
|
||||||
sparql.setQuery('''
|
sparql.setQuery('''
|
||||||
SELECT ?publishers ?publishersLabel ?publishersAltLabel ?publishersDescription WHERE {
|
SELECT ?publishers ?publishersLabel ?publishersAltLabel ?publishersDescription WHERE {
|
||||||
{
|
{
|
||||||
SELECT ?publishers (COUNT(DISTINCT ?a) AS ?count) WHERE {
|
SELECT ?publishers (COUNT(DISTINCT ?a) AS ?count) WHERE {
|
||||||
?a ?prop ?publishers .
|
?a ?prop ?publishers .
|
||||||
?a wdt:P1 ?work .
|
?a wdt:P1 ?work .
|
||||||
BIND (wdt:P10 AS ?prop) .
|
?publishers wdt:P1 ?typeofpublisher.
|
||||||
BIND (wd:Q1 AS ?work) .
|
BIND (wdt:P10 AS ?prop) .
|
||||||
} GROUP BY ?publishers
|
BIND (wd:Q1 AS ?work)
|
||||||
} .
|
BIND (wd:Q12 AS ?typeofpublisher).
|
||||||
SERVICE wikibase:label {
|
} GROUP BY ?publishers
|
||||||
bd:serviceParam wikibase:language "en" .
|
} .
|
||||||
}
|
SERVICE wikibase:label {
|
||||||
FILTER(?publishers != wd:Q83)
|
bd:serviceParam wikibase:language "en" .
|
||||||
FILTER(?publishers != wd:Q71)
|
}
|
||||||
}
|
FILTER(?publishers != wd:Q83)
|
||||||
ORDER BY DESC(?count) ?publishersLabel
|
FILTER(?publishers != wd:Q71)
|
||||||
|
}
|
||||||
|
ORDER BY DESC(?count) ?publishersLabel
|
||||||
''')
|
''')
|
||||||
sparql.setReturnFormat(JSON)
|
sparql.setReturnFormat(JSON)
|
||||||
results = sparql.query().convert()
|
results = sparql.query().convert()
|
||||||
|
@ -176,7 +176,7 @@
|
|||||||
<!-- else loop through available data -->
|
<!-- else loop through available data -->
|
||||||
{% for x in orglocation['results']['bindings'] %}
|
{% for x in orglocation['results']['bindings'] %}
|
||||||
<span>{{ x['locationLabel']['value'] }}
|
<span>{{ x['locationLabel']['value'] }}
|
||||||
{{ ", " if not loop.last else "" }}
|
{{ "; " if not loop.last else "" }}
|
||||||
</span>
|
</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -192,7 +192,7 @@
|
|||||||
{% for x in orgcountry['results']['bindings'] %}
|
{% for x in orgcountry['results']['bindings'] %}
|
||||||
<span>{{ x['countryLabel']['value'] }}
|
<span>{{ x['countryLabel']['value'] }}
|
||||||
{% if not loop.last %}
|
{% if not loop.last %}
|
||||||
,
|
;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user