Browse Source

last changes

master
jules 4 years ago
parent
commit
c20d80a59d
  1. 23
      daapinterface.py
  2. 41
      templates/artwork.html

23
daapinterface.py

@ -217,7 +217,6 @@ def artwork():
''')
sparql.setReturnFormat(JSON)
artworkintro = sparql.query().convert()
# print(artworkintro)
# Image(s)
# query for later
@ -252,7 +251,6 @@ def artwork():
sparql.setReturnFormat(JSON)
artworkimages = sparql.query().convert()
# print(artworkimages)
# Links and downloads
sparql.setQuery('''
@ -267,7 +265,6 @@ def artwork():
}''')
sparql.setReturnFormat(JSON)
artworklinksanddownloads = sparql.query().convert()
print(artworklinksanddownloads)
# Other digital artefacts
sparql.setQuery('''
@ -276,19 +273,21 @@ def artwork():
{
{
SELECT ?ImageFile WHERE {
VALUES ?work {wd:Q57}
VALUES ?work {wd:'''+artwork_id+'''}
OPTIONAL {?work p:P35 ?statement.
?statement ps:P35 ?ImageFile;
pq:P16 wd:Q85.}
}}
{
SELECT ?AudioFile WHERE {
VALUES ?work {wd:'''+artwork_id+'''}
OPTIONAL {?work p:P35 ?statement.
?statement ps:P35 ?AudioFile;
pq:P16 wd:Q28.}
}}
{
SELECT ?VideoFile WHERE {
VALUES ?work {wd:'''+artwork_id+'''}
OPTIONAL {?work p:P35 ?statement.
?statement ps:P35 ?VideoFile;
pq:P16 wd:Q27.}
@ -298,7 +297,7 @@ def artwork():
''')
sparql.setReturnFormat(JSON)
artworkartefacts = sparql.query().convert()
# print(artworkartefacts)
print(artworkartefacts)
# Distributor Links
@ -335,7 +334,6 @@ def artwork():
''')
sparql.setReturnFormat(JSON)
artworkcontributors = sparql.query().convert()
# print(artworkcontributors)
# date
sparql.setQuery('''
@ -352,7 +350,6 @@ def artwork():
''')
sparql.setReturnFormat(JSON)
artworkdate = sparql.query().convert()
# print(artworkdate)
# publishers
sparql.setQuery('''
@ -373,8 +370,6 @@ def artwork():
''')
sparql.setReturnFormat(JSON)
artworkpublisher = sparql.query().convert()
# print(artworkpublisher)
#####right middle
# description + id to be changed
@ -395,16 +390,10 @@ def artwork():
artworkdescriptiondata = sparql.query().convert()
# get the description text or say there isn't any
# artworkdescriptiontext = []
for x in artworkdescriptiondata['results']['bindings']:
if "accessURLdescriptionPage" in x:
# print("url for description present")
# print(x["accessURLdescriptionPage"]["value"])
accessURLdescriptionUrl = x["accessURLdescriptionPage"]["value"]
desc_url = re.search(r':Q(.*)', accessURLdescriptionUrl, re.DOTALL)
# print(desc_url.group(1))
desc_id=desc_url.group(1)
# # get the description content from wiki
artworkdescriptioncontenturl = "https://daap.bannerrepeater.org/w/index.php?title=Description:Q"+desc_id+"&action=render"
@ -444,8 +433,6 @@ def artwork():
# get the text from the url
for x in artworkexhibitiondata['results']['bindings']:
if "accessURLexhibitionHisPage" in x:
# print("url for description present")
# print(x["accessURLexhibitionHisPage"]["value"])
accessURLexhibitionHisPage = x["accessURLexhibitionHisPage"]["value"]
desc_url = re.search(r':Q(.*)', accessURLexhibitionHisPage, re.DOTALL)
# print(desc_url.group(1))
@ -467,7 +454,6 @@ def artwork():
# artworkexhibitiontext=Markup(text)
x['text']=text
# print(artworkexhibitiondata)
############## bottom
@ -519,7 +505,6 @@ def artwork():
''')
sparql.setReturnFormat(JSON)
artworklists = sparql.query().convert()
# print(artworklists)
return render_template('artwork.html', artwork_id=artwork_id, artworkintro=artworkintro, artworkimages=artworkimages, artworklinksanddownloads=artworklinksanddownloads, artworkartefacts=artworkartefacts, artworkdistributorlinks=artworkdistributorlinks, artworkcontributors=artworkcontributors, artworkdate=artworkdate, artworkpublisher=artworkpublisher, artworkdescriptiondata=artworkdescriptiondata, artworkexhibitiondata=artworkexhibitiondata, artworklists=artworklists, copiesincollection=copiesincollection, relatedworks=relatedworks)

41
templates/artwork.html

@ -63,6 +63,10 @@
{% for x in artworklinksanddownloads['results']['bindings'] %}
<p class="label-item">DOWNLOADS AND LINKS</p>
{% if ('DownloadDigitalFacsimile' not in x) and ('DigitalFacsimileExternalLink' not in x) and ('DigitalFacsimileExternalLink2' not in x) %}
<p>information not available</p>
{% endif %}
{% if 'DownloadDigitalFacsimile' in x %}
<div>
<a target="_blank" href="{{ x['DownloadDigitalFacsimile']['value'] }}"><img src="{{ url_for('static', filename='/imgs/Icons/icn_download.svg') }}"></a>
@ -92,10 +96,14 @@
<!-- OTHER DIGITAL ARTEFACTS -->
<div>
{% if artworkartefacts['results']['bindings']==[] %}
<p>information not available</p>
{% else %}
<p class="label-item">OTHER DIGTAL ARTEFACTS</p>
<!-- video images audio -->
{% for x in artworkartefacts['results']['bindings'] %}
{{ x }}
{% endfor %}
{% endif %}
</div>
@ -106,11 +114,16 @@
{% else %}
<p class="label-item">DISTRIBUTOR LINKS</p>
{% for x in artworkdistributorlinks['results']['bindings'] %}
{% if 'distributorLinks' not in x %}
<p>information not available</p>
{% endif %}
{% if 'distributorLinks' in x %}
<div>
<img src="{{ url_for('static', filename='/imgs/Icons/icn_external_link.svg') }}">
<a target="_blank" href="{{ x['distributorLinks']['value'] }}">{{ x['distributorLinks']['value'] }}</a>
</div>
{% endif %}
{% endfor %}
</p>
@ -124,9 +137,15 @@
<!-- RIGHT COLUMN -->
<div class="artwork-rightcolumn">
<!-- RIGHT TOP -->
<!-- contributors -->
<div class="artwork-rightcolumn-top-contributors">
<p class="label-item">CONTRIBUTORS</p>
<!-- check if info not available -->
{% if artworkcontributors['results']['bindings']==[] %}
<div>information not available</div>
{% else %}
<!-- else loop through available data -->
{% for x in artworkcontributors['results']['bindings'] %}
<!-- name surname -->
<div class="metadata-link">
@ -137,17 +156,22 @@
<p>{{ x['role']['value'] }}</p>
</div>
{% endfor %}
{% endif %}
</div>
<!-- date -->
<div class="artwork-rightcolumn-top-date">
<p class="label-item">DATE</p>
<!-- loops through dates -->
<!-- check if info not available -->
{% if artworkdate['results']['bindings']==[] %}
<div>information not available</div>
{% else %}
<!-- else loops through available dates -->
{% for x in artworkdate['results']['bindings'] %}
<!-- date -->
{% if 'date' in x %}
<div class="label-item-date-artwork">{{ x['date']['value'] | replace("T00:00:00Z", "") }}</div>
{% else %}
but <div>information not available</div>
{% endif %}
<!-- extra info if available -->
@ -155,18 +179,21 @@
<div>Source: {{ x['sourceLabel']['value'] }}</div>
{% endif %}
{% endfor %}
{% endif %}
<!-- publishers removed div .artwork-rightcolumn-top-publishers-->
<p class="label-item">PUBLISHERS</p>
<!-- loop through publishers -->
{% if artworkpublisher['results']['bindings']==[] %}
<span>information not available</span>
{% else %}
{% for x in artworkpublisher['results']['bindings'] %}
<!-- name, surname -->
<div class="metadata-link artwork-rightcolumn-top-publishers-item">
{% if 'publishersLabel' in x %}
<a href='/organisation?id={{ x["publishers"]["value"] | replace("http://daap.bannerrepeater.org/entity/", "") }}'><span>{{ x['publishersLabel']['value'] }}</span></a>
{% else %}
<span>information not available</span>
{% endif %}
<!-- role -->
{% if 'role' in x %}
@ -174,6 +201,8 @@
{% endif %}
<div>
{% endfor %}
{% endif %}
</div>
</div>
</div>

Loading…
Cancel
Save