artwork page for now description and exhibition are missing still
This commit is contained in:
parent
2354a59851
commit
4356b3b147
104
daapinterface.py
104
daapinterface.py
@ -195,6 +195,97 @@ def zinesindex():
|
||||
def artwork():
|
||||
artwork_id = request.args.get('id')
|
||||
|
||||
# Artwork Intro / Top of the page
|
||||
sparql.setQuery('''
|
||||
SELECT ?work ?workLabel ?workDescription ?itemtypeLabel
|
||||
{
|
||||
VALUES ?work {wd:'''+artwork_id+'''}
|
||||
?work wdt:P1 ?itemtype.
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
|
||||
}
|
||||
''')
|
||||
sparql.setReturnFormat(JSON)
|
||||
artworkintro = sparql.query().convert()
|
||||
# print(artworkintro)
|
||||
|
||||
# Image(s)
|
||||
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".}
|
||||
}
|
||||
''')
|
||||
sparql.setReturnFormat(JSON)
|
||||
artworkimages = sparql.query().convert()
|
||||
# print(artworkimages)
|
||||
|
||||
# contributors
|
||||
sparql.setQuery('''
|
||||
SELECT DISTINCT ?creators ?creatorsLabel (group_concat(?creatorRolesLabel; separator="; ") as ?role)
|
||||
WHERE
|
||||
{
|
||||
VALUES ?work {wd:Q118}
|
||||
?work wdt:P9 ?creators.
|
||||
OPTIONAL { ?work p:P9 ?statement1.
|
||||
?statement1 ps:P9 ?creators;
|
||||
pq:P49 ?creatorRoles. }
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
|
||||
?creators rdfs:label ?creatorsLabel.
|
||||
?creatorRoles rdfs:label ?creatorRolesLabel. }
|
||||
}
|
||||
GROUP BY ?creators ?creatorsLabel
|
||||
ORDER BY ?creatorsLabel
|
||||
''')
|
||||
sparql.setReturnFormat(JSON)
|
||||
artworkcontributors = sparql.query().convert()
|
||||
# print(artworkcontributors)
|
||||
|
||||
# date
|
||||
sparql.setQuery('''
|
||||
SELECT ?date ?sourceLabel
|
||||
WHERE
|
||||
{
|
||||
VALUES ?work {wd:'''+artwork_id+'''}
|
||||
?work wdt:P13 ?date.
|
||||
OPTIONAL { ?work p:P13 ?statement1.
|
||||
?statement1 ps:P13 ?date;
|
||||
pq:P50 ?source. }
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".}
|
||||
}
|
||||
''')
|
||||
sparql.setReturnFormat(JSON)
|
||||
artworkdate = sparql.query().convert()
|
||||
# print(artworkdate)
|
||||
|
||||
# publishers
|
||||
sparql.setQuery('''
|
||||
SELECT DISTINCT ?publishers ?publishersLabel (group_concat(?publishersRolesLabel; separator="; ") as ?role)
|
||||
WHERE
|
||||
{
|
||||
VALUES ?work {wd:'''+artwork_id+'''}
|
||||
?work wdt:P10 ?publishers.
|
||||
OPTIONAL { ?work p:P10 ?statement1.
|
||||
?statement1 ps:P10 ?publishers;
|
||||
pq:P49 ?creatorRoles. }
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
|
||||
?publishers rdfs:label ?publishersLabel.
|
||||
?publishersRoles rdfs:label ?publishersRolesLabel. }
|
||||
}
|
||||
GROUP BY ?publishers ?publishersLabel
|
||||
ORDER BY ?publishersLabel
|
||||
''')
|
||||
sparql.setReturnFormat(JSON)
|
||||
artworkpublisher = sparql.query().convert()
|
||||
print(artworkpublisher)
|
||||
|
||||
|
||||
# copies in collection
|
||||
sparql.setQuery('''
|
||||
SELECT ?copiesCollections ?copiesCollectionsLabel ?collection ?collectionLabel ?image
|
||||
@ -208,7 +299,7 @@ def artwork():
|
||||
} ''')
|
||||
sparql.setReturnFormat(JSON)
|
||||
copiesincollection = sparql.query().convert()
|
||||
print(copiesincollection)
|
||||
# print(copiesincollection)
|
||||
|
||||
# related works
|
||||
sparql.setQuery('''
|
||||
@ -229,18 +320,15 @@ def artwork():
|
||||
} ''')
|
||||
sparql.setReturnFormat(JSON)
|
||||
relatedworks = sparql.query().convert()
|
||||
print(relatedworks)
|
||||
# print(relatedworks)
|
||||
|
||||
|
||||
# artwork_url = "https://daap.bannerrepeater.org/wiki/Item:Q92"
|
||||
# artwork_title = "the human printer"
|
||||
# artwork_description = "short description"
|
||||
return render_template('artwork.html', copiesincollection=copiesincollection, relatedworks=relatedworks)
|
||||
return render_template('artwork.html', artworkintro=artworkintro, artworkimages=artworkimages, artworkcontributors=artworkcontributors, artworkdate=artworkdate, artworkpublisher=artworkpublisher, copiesincollection=copiesincollection, relatedworks=relatedworks)
|
||||
|
||||
|
||||
|
||||
|
||||
######################### PERSON
|
||||
######################### PERSON - FOR NOW THIS IS A MESS
|
||||
@app.route("/person", methods=['GET'])
|
||||
def person():
|
||||
person_id = request.args.get('id')
|
||||
@ -408,7 +496,7 @@ raw_html = response['parse']['text']['*']
|
||||
document = html.document_fromstring(raw_html)
|
||||
first_p = document.xpath('//p')[0]
|
||||
intro_text = first_p.text_content()
|
||||
print(intro_text)
|
||||
# print(intro_text)
|
||||
|
||||
|
||||
# ALL NAME
|
||||
|
@ -4,12 +4,120 @@
|
||||
<div>
|
||||
|
||||
<!-- Artwork title and navigation -->
|
||||
<div></div>
|
||||
<div>
|
||||
<!-- ARTWORK label in rectangle -->
|
||||
<div>
|
||||
<span>ARTWORK</span>
|
||||
</div>
|
||||
<!-- Artwork title -->
|
||||
<div>
|
||||
{% for x in artworkintro['results']['bindings'] %}
|
||||
{{ x['workLabel']['value'] }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- Artwork intro-description -->
|
||||
<div>
|
||||
{% for x in artworkintro['results']['bindings'] %}
|
||||
{% if 'workDescription' in x %}
|
||||
{{ x['workDescription']['value'] }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<!-- NAVIGATION HERE? -->
|
||||
<div class="artwork-nav">
|
||||
<div>ABOUT THIS WORK</div>
|
||||
<div>RELATIONSHIPS</div>
|
||||
<div>LISTS</div>
|
||||
<div><a href="">DETAILED RECORD</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- The content in 3 divs displayed or not (detailed revord is out)-->
|
||||
<div>
|
||||
<!-- about -->
|
||||
<div></div>
|
||||
<div class="artwork-about">
|
||||
<!-- left -->
|
||||
<div class="artwork-leftcolumn">
|
||||
<!-- img - I am unsure how to handle the thing to go through the different pictures -->
|
||||
<div class="artwork-about-img">
|
||||
{% for x in artworkimages['results']['bindings'] %}
|
||||
{% if loop.index <= 1 %}
|
||||
{% if "image" in x %}
|
||||
<img class="artwork-about-imgs" src='{{ x["image"]["value"] | replace("wiki/File:","wiki/Special:Redirect/file/") }}'>
|
||||
{% else %}
|
||||
<img class="artwork-about-imgs" src="{{ url_for('static', filename='/imgs/Icons/placeholder_no-image2.png') }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- other stuff like downloads, absent for now -->
|
||||
<div></div>
|
||||
</div>
|
||||
<!-- right -->
|
||||
<div class="artwork-rightcolumn">
|
||||
<!-- contributors / date / publishers -->
|
||||
<div class="artwork-rightcolumn-top">
|
||||
<!-- contributors -->
|
||||
<div class="artwork-rightcolumn-top-contributors">
|
||||
<span>CONTRIBUTORS</span>
|
||||
{% for x in artworkcontributors['results']['bindings'] %}
|
||||
<!-- name surname -->
|
||||
<div>
|
||||
<a href='/person?id={{ x["creators"]["value"] | replace("http://daap.bannerrepeater.org/entity/", "") }}'>
|
||||
<span>{{ x['creatorsLabel']['value'] }}</span>
|
||||
</a>
|
||||
</div>
|
||||
<!-- role/function -->
|
||||
<div>
|
||||
<span>{{ x['role']['value'] }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- date -->
|
||||
<div class="artwork-rightcolumn-top-date">
|
||||
<span>DATE</span>
|
||||
<!-- loops through dates -->
|
||||
{% for x in artworkdate['results']['bindings'] %}
|
||||
<!-- date -->
|
||||
{% if 'date' in x %}
|
||||
<div>{{ x['date']['value'] | replace("T00:00:00Z", "") }}</div>
|
||||
{% else %}
|
||||
but <div>information not available</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- extra info if available -->
|
||||
{% if 'sourceLabel' in x %}
|
||||
<div>Source: {{ x['sourceLabel']['value'] }}</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- publishers -->
|
||||
<div class="artwork-rightcolumn-top-publishers">
|
||||
<span>PUBLISHERS</span>
|
||||
<!-- loop through publishers -->
|
||||
{% for x in artworkpublisher['results']['bindings'] %}
|
||||
<!-- name, surname -->
|
||||
<div class="artwork-rightcolumn-top-publishers-item">
|
||||
{% if 'publishersLabel' in x %}
|
||||
<a href=""><span>{{ x['publishersLabel']['value'] }}</span></a>
|
||||
{% else %}
|
||||
<span>information not available</span>
|
||||
{% endif %}
|
||||
<!-- role -->
|
||||
{% if 'role' in x %}
|
||||
<span>{{ x['role']['value'] }}</span>
|
||||
{% endif %}
|
||||
<div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<!-- description -->
|
||||
<div></div>
|
||||
<!-- exhibition and distribution history -->
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- relationships -->
|
||||
<div></div>
|
||||
@ -29,7 +137,7 @@
|
||||
<!-- img -->
|
||||
<div class="artwork-copiesincollection-img-div">
|
||||
{% if "image" in x %}
|
||||
<!-- <a href='/artwork?id={{ x["???"]["copiesCollections"] | replace("http://daap.bannerrepeater.org/entity/", "") }}'> -->
|
||||
<!-- <a href='/artwork?id={{ x["copiesCollections"]["value"] | replace("http://daap.bannerrepeater.org/entity/", "") }}'> -->
|
||||
<img class="artwork-copiesincollection-imgs" src='{{ x["image"]["value"] | replace("wiki/File:","wiki/Special:Redirect/file/") }}'>
|
||||
<!-- </a> -->
|
||||
<br>
|
||||
|
Loading…
Reference in New Issue
Block a user