Browse Source

last version artwork and daap

master
jules 4 years ago
parent
commit
f305e9259a
  1. 39
      daapinterface.py
  2. 52
      templates/artwork.html

39
daapinterface.py

@ -127,7 +127,6 @@ def artistsindex():
''') ''')
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
@ -220,23 +219,8 @@ def artwork():
# Image(s) # Image(s)
# query for later # 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+'''}
@ -245,12 +229,28 @@ 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".}
}''') }
''')
# temp fix query
# 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.}
# FILTER(?depicts != wd:Q1897)
# SERVICE wikibase:label { bd:serviceParam wikibase:language "en".}
# }''')
sparql.setReturnFormat(JSON) sparql.setReturnFormat(JSON)
artworkimages = sparql.query().convert() artworkimages = sparql.query().convert()
print(artworkimages)
# Links and downloads # Links and downloads
sparql.setQuery(''' sparql.setQuery('''
@ -412,6 +412,7 @@ def artwork():
text="<p>Information not available</p>" text="<p>Information not available</p>"
x["text"] = text x["text"] = text
print(artworkdescriptiondata)
# exhibitions + id to be changed # exhibitions + id to be changed
sparql.setQuery(''' sparql.setQuery('''

52
templates/artwork.html

@ -27,10 +27,10 @@
<!-- NAVIGATION HERE? --> <!-- NAVIGATION HERE? -->
<div class="artwork-nav"> <div class="artwork-nav">
<div class="artwork-nav-label artwork-nav-label-about active">ABOUT THIS WORK</div> <div class="artwork-nav-label active">ABOUT THIS WORK</div>
<!-- <div class="artwork-nav-label">RELATIONSHIPS</div> --> <!-- <div class="artwork-nav-label">RELATIONSHIPS</div> -->
<!-- <div class="artwork-nav-label">LISTS</div> --> <!-- <div class="artwork-nav-label">LISTS</div> -->
<div class="artwork-nav-label artwork-nav-label-record"><a class="det-record" target="_blank" href="https://daap.bannerrepeater.org/wiki/Item:{{ artwork_id }}">DETAILED RECORD</a></div> <div class="artwork-nav-label"><a class="det-record" target="_blank" href="https://daap.bannerrepeater.org/wiki/Item:{{ artwork_id }}">DETAILED RECORD</a></div>
</div> </div>
</div> </div>
@ -159,11 +159,11 @@
<!-- end of other stuff like downloads, absent for now --> <!-- end of other stuff like downloads, absent for now -->
<!-- RIGHT COLUMN <!-- RIGHT COLUMN -->
<div class="artwork-rightcolumn"> <div class="artwork-rightcolumn">
-->
<!-- RIGHT TOP <!-- RIGHT TOP -->
<div class="artwork-rightcolumn-top"> --> <div class="artwork-rightcolumn-top">
<!-- contributors --> <!-- contributors -->
<div class="artwork-rightcolumn-top-contributors"> <div class="artwork-rightcolumn-top-contributors">
<p class="label-item">CONTRIBUTORS</p> <p class="label-item">CONTRIBUTORS</p>
@ -206,11 +206,11 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<!-- </div> --> </div>
<!-- end of date --> <!-- end of date -->
<!-- publishers--> <!-- publishers-->
<!-- <div class="artwork-rightcolumn-top-publishers"> --> <div class="artwork-rightcolumn-top-publishers">
<p class="label-item">PUBLISHERS</p> <p class="label-item">PUBLISHERS</p>
<!-- loop through publishers --> <!-- loop through publishers -->
{% if artworkpublisher['results']['bindings']==[] %} {% if artworkpublisher['results']['bindings']==[] %}
@ -232,14 +232,14 @@
{% endif %} {% endif %}
</div> </div>
<!-- end of publishers--> <!-- end of publishers-->
<!-- </div> artwork-rightcolumn-top --> </div>
<!-- end of about right top --> <!-- end of about right top -->
<!-- start of about right column bottom --> <!-- start of about right column bottom -->
<!-- <div class="artwork-rightcolumn-bottom"> --> <div class="artwork-rightcolumn-bottom">
<!-- description --> <!-- description -->
@ -248,31 +248,30 @@
{% else %} {% else %}
<!-- For loop --> <!-- For loop -->
{% for x in artworkdescriptiondata['results']['bindings'] %} {% for x in artworkdescriptiondata['results']['bindings'] %}
<div class="artwork-rightcolumn-description"> <div>
<p class="label-item">DESCRIPTION</p> <p class="label-item">DESCRIPTION</p>
<!-- left part with the description text already coming in a div from wiki--> <!-- left part with the description text already coming in a div from wiki-->
<div class="text-description"> <div>
{{ x["text"] | safe }} {{ x["text"] | safe }}
</div> </div>
<!-- right ride with author etc LATER--> <!-- right ride with author etc LATER-->
<div class="text-date-author"> <div>
{% if "authordescriptionPageLabel" in x %}
<p class="label-item">AUTHOR</p> <p class="label-item">AUTHOR</p>
{% if "authordescriptionPageLabel" in x %}
<p>{{ x['authordescriptionPageLabel']['value'] }}</p> <p>{{ x['authordescriptionPageLabel']['value'] }}</p>
{% endif %} {% endif %}
<!-- if there is an author name then add here otherwise info non available --> <!-- if there is an author name then add here otherwise info non available -->
{% if "sourcedescriptionPage" in x %}
<p class="label-item">SOURCE</p> <p class="label-item">SOURCE</p>
{% if "sourcedescriptionPage" in x %}
<p>{{ x["sourcedescriptionPage"]["value"]}} </p> <p>{{ x["sourcedescriptionPage"]["value"]}} </p>
<!-- if there is a source name then add here otherwise info non available --> <!-- if there is a source name then add here otherwise info non available -->
{% endif %} {% endif %}
{% if "datedescriptionPage" in x %}
<p class="label-item">DATE</p> <p class="label-item">DATE</p>
{% if "datedescriptionPage" in x %}
<p>{{ x["datedescriptionPage"]["value"] | replace("T00:00:00Z", "") }}</p> <p>{{ x["datedescriptionPage"]["value"] | replace("T00:00:00Z", "") }}</p>
{% endif %} {% endif %}
<!-- if there is a date add here otherwise info non available--> <!-- if there is a date add here otherwise info non available-->
@ -290,22 +289,29 @@
{% else %} {% else %}
{% for x in artworkexhibitiondata['results']['bindings'] %} {% for x in artworkexhibitiondata['results']['bindings'] %}
<div class="artwork-rightcolumn-exhibition"> <div>
<p class="label-item">EXHIBITION AND DISTRIBUTION HISTORY</p> <p class="label-item">EXHIBITION AND DISTRIBUTION HISTORY</p>
<div class="text-exhibition"> <div>
{{ x['text'] | safe }} {{ x['text'] | safe }}
</div> </div>
<!-- right ride with author etc LATER--> <!-- right ride with author etc LATER-->
<div class="text-date-author"> <div>
<p class="label-item">AUTHOR</p> <p class="label-item">AUTHOR</p>
<!-- if there is an author name then add here otherwise info non available --> <!-- if there is an author name then add here otherwise info non available -->
{% if "authorexhibitionHisPageLabel" in x %} {% if "authorexhibitionHisPageLabel" in x %}
<p>{{ x["authorexhibitionHisPageLabel"]["value"]}} </p> <p>{{ x["authorexhibitionHisPageLabel"]["value"]}} </p>
{% endif %} {% endif %}
{% if "authorexhibitionHisPageLabel" not in x %}
<p>information not available</p>
{% endif %}
<p class="label-item">SOURCE</p> <p class="label-item">SOURCE</p>
<!-- if there is a source name then add here otherwise info non available --> <!-- if there is a source name then add here otherwise info non available -->
{% if "sourceexhibitionHisPage" not in x %}
<p>information not available </p>
{% endif %}
{% if "sourceexhibitionHisPage" in x%} {% if "sourceexhibitionHisPage" in x%}
<p>{{ x["sourceexhibitionHisPage"]["value"]}} </p> <p>{{ x["sourceexhibitionHisPage"]["value"]}} </p>
{% endif %} {% endif %}
@ -322,8 +328,8 @@
{% endif %} {% endif %}
<!-- end exhibition loop --> <!-- end exhibition loop -->
<!-- </div> end of right column --> <!-- end of right column -->
</div>
<!-- end of about --> <!-- end of about -->
</div> </div>

Loading…
Cancel
Save