cover artwork pages
This commit is contained in:
parent
8fe3bd23cd
commit
c3537d9987
@ -220,8 +220,24 @@ def artwork():
|
|||||||
# print(artworkintro)
|
# print(artworkintro)
|
||||||
|
|
||||||
# Image(s)
|
# Image(s)
|
||||||
|
# query for later
|
||||||
|
# sparql.setQuery('''
|
||||||
|
# SELECT ?image ?depictsLabel ?licenseLabel
|
||||||
|
# WHERE
|
||||||
|
# {
|
||||||
|
# VALUES ?work {wd:'''+artwork_id+'''}
|
||||||
|
# ?work wdt:P30 ?image.
|
||||||
|
# OPTIONAL { ?work p:P30 ?statement2.
|
||||||
|
# ?statement2 ps:P30 ?image;
|
||||||
|
# pq:P54 ?depicts;
|
||||||
|
# pq:P56 ?license.}
|
||||||
|
# SERVICE wikibase:label { bd:serviceParam wikibase:language "en".}
|
||||||
|
# }
|
||||||
|
# ''')
|
||||||
|
# temp fix query
|
||||||
|
|
||||||
sparql.setQuery('''
|
sparql.setQuery('''
|
||||||
SELECT ?image ?depictsLabel ?licenseLabel
|
SELECT ?image ?depictsLabel ?licenseLabel
|
||||||
WHERE
|
WHERE
|
||||||
{
|
{
|
||||||
VALUES ?work {wd:'''+artwork_id+'''}
|
VALUES ?work {wd:'''+artwork_id+'''}
|
||||||
@ -230,9 +246,10 @@ def artwork():
|
|||||||
?statement2 ps:P30 ?image;
|
?statement2 ps:P30 ?image;
|
||||||
pq:P54 ?depicts;
|
pq:P54 ?depicts;
|
||||||
pq:P56 ?license.}
|
pq:P56 ?license.}
|
||||||
|
FILTER(?depicts != wd:Q1897)
|
||||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".}
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".}
|
||||||
}
|
}''')
|
||||||
''')
|
|
||||||
sparql.setReturnFormat(JSON)
|
sparql.setReturnFormat(JSON)
|
||||||
artworkimages = sparql.query().convert()
|
artworkimages = sparql.query().convert()
|
||||||
print(artworkimages)
|
print(artworkimages)
|
||||||
|
@ -45,12 +45,8 @@
|
|||||||
{% if artworkimages['results']['bindings']==[] %}
|
{% if artworkimages['results']['bindings']==[] %}
|
||||||
<img class="artwork-about-imgs" src="{{ url_for('static', filename='/imgs/Icons/placeholder_no-image2.png') }}">
|
<img class="artwork-about-imgs" src="{{ url_for('static', filename='/imgs/Icons/placeholder_no-image2.png') }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for x in artworkimages['results']['bindings'] %}
|
{% for x in artworkimages["results"]["bindings"] %}
|
||||||
{% if loop.index <= 1 %}
|
<img class="artwork-about-imgs" src='{{ x["image"]["value"] | replace("wiki/File:","wiki/Special:Redirect/file/") }}'>
|
||||||
{% if "image" in x %}
|
|
||||||
<img class="artwork-about-imgs" src='{{ x["image"]["value"] | replace("wiki/File:","wiki/Special:Redirect/file/") }}'>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user