Browse Source

artwork template , target blank link home, local img substitution

master
jules 4 years ago
parent
commit
4fbb5a5593
  1. 38
      daapinterface.py
  2. 83
      templates/artwork.html
  3. 2
      templates/home.html

38
daapinterface.py

@ -41,8 +41,8 @@ def home():
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?work wdt:P1 wd:Q1;
wdt:P87 ?dateadded.
?work p:P30 ?statement.
?statement ps:P30 ?image;
?work p:P90 ?statement.
?statement ps:P90 ?image;
pq:P54 wd:Q90.
?work wdt:P13 ?date.
FILTER(?work != wd:Q57)
@ -73,8 +73,8 @@ def browsethearchive():
SELECT ?work ?workLabel ?image ?date WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?work wdt:P1 wd:Q1.
OPTIONAL { ?work p:P30 ?statement.
?statement ps:P30 ?image;
OPTIONAL { ?work p:P90 ?statement.
?statement ps:P90 ?image;
pq:P54 wd:Q90.}
OPTIONAL { ?work wdt:P13 ?date. }
FILTER(?work != wd:Q57)
@ -163,8 +163,8 @@ def selfpublishedindex():
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?work wdt:P1 wd:Q1;
wdt:P10 wd:Q71.
OPTIONAL {?work p:P30 ?statement.
?statement ps:P30 ?image;
OPTIONAL {?work p:P90 ?statement.
?statement ps:P90 ?image;
pq:P54 wd:Q90.}
OPTIONAL { ?work wdt:P13 ?date. }
FILTER(?work != wd:Q57)
@ -183,8 +183,8 @@ def zinesindex():
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?work wdt:P1 wd:Q1;
wdt:P10 wd:Q71.
OPTIONAL {?work p:P30 ?statement.
?statement ps:P30 ?image;
OPTIONAL {?work p:P90 ?statement.
?statement ps:P90 ?image;
pq:P54 wd:Q90.}
OPTIONAL { ?work wdt:P13 ?date. }
FILTER(?work != wd:Q57)
@ -224,9 +224,9 @@ def artwork():
WHERE
{
VALUES ?work {wd:'''+artwork_id+'''}
?work wdt:P30 ?image.
OPTIONAL { ?work p:P30 ?statement2.
?statement2 ps:P30 ?image;
?work wdt:P90 ?image.
OPTIONAL { ?work p:P90 ?statement2.
?statement2 ps:P90 ?image;
pq:P54 ?depicts;
pq:P56 ?license.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".}
@ -239,9 +239,9 @@ def artwork():
# WHERE
# {
# VALUES ?work {wd:'''+artwork_id+'''}
# ?work wdt:P30 ?image.
# OPTIONAL { ?work p:P30 ?statement2.
# ?statement2 ps:P30 ?image;
# ?work wdt:P90 ?image.
# OPTIONAL { ?work p:P90 ?statement2.
# ?statement2 ps:P90 ?image;
# pq:P54 ?depicts;
# pq:P56 ?license.}
# FILTER(?depicts != wd:Q1897)
@ -466,7 +466,7 @@ def artwork():
VALUES ?work {wd:'''+artwork_id+'''}
?work wdt:P43 ?copiesCollections.
?copiesCollections wdt:P47 ?collection.
OPTIONAL { ?collection wdt:P30 ?image. }
OPTIONAL { ?collection wdt:P90 ?image. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} ''')
sparql.setReturnFormat(JSON)
@ -487,7 +487,7 @@ def artwork():
GROUP BY ?relatedWorks ?relatedWorksLabel
ORDER BY ?relatedWorksLabel
}
OPTIONAL {?relatedWorks wdt:P30 ?image.}
OPTIONAL {?relatedWorks wdt:P90 ?image.}
} ''')
sparql.setReturnFormat(JSON)
relatedworks = sparql.query().convert()
@ -500,7 +500,7 @@ def artwork():
VALUES ?work {wd:'''+artwork_id+'''}
?work wdt:P45 ?list.
OPTIONAL {?list wdt:P13 ?date.}
OPTIONAL {?list wdt:P30 ?image.}
OPTIONAL {?list wdt:P90 ?image.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".}
}
''')
@ -543,7 +543,7 @@ def person():
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?work wdt:P1 wd:Q1.
?work wdt:P9 wd:'''+person_id+'''.
OPTIONAL { ?work wdt:P30 ?image. }
OPTIONAL { ?work wdt:P90 ?image. }
OPTIONAL { ?work wdt:P13 ?date. }
FILTER(?work != wd:Q57)
}
@ -558,7 +558,7 @@ def person():
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?work wdt:P1 wd:Q1.
?work wdt:P10 wd:'''+person_id+'''.
OPTIONAL { ?work wdt:P30 ?image. }
OPTIONAL { ?work wdt:P90 ?image. }
OPTIONAL { ?work wdt:P13 ?date. }
FILTER(?work != wd:Q57)
}

83
templates/artwork.html

@ -49,7 +49,7 @@
<img src="{{ url_for('static', filename='/imgs/Icons/placeholder_no-image2.png') }}">
{% else %}
{% for x in artworkimages['results']['bindings'] |reverse %}
{% for x in artworkimages['results']['bindings'] %}
<div class="item">
<!-- START GROUP IMG + LABELS -->
{% if "image" in x %}
@ -95,21 +95,21 @@
{% if 'DownloadDigitalFacsimile' in x %}
<div>
<a target="_blank" href="{{ x['DownloadDigitalFacsimile']['value'] }}"><img src="{{ url_for('static', filename='/imgs/Icons/icn_download.svg') }}"></a>
<span>Download digital facsimile</span>
<a target="_blank" href="{{ x['DownloadDigitalFacsimile']['value'] }}"><span>Download digital facsimile</span></a>
</div>
{% endif %}
{% if 'DigitalFacsimileExternalLink' in x %}
<div>
<a target="_blank" href="{{ x['DigitalFacsimileExternalLink']['value'] }}"><img src="{{ url_for('static', filename='/imgs/Icons/icn_external_link.svg') }}"></a>
<span>External digital facsimile link</span>
<a target="_blank" href="{{ x['DigitalFacsimileExternalLink']['value'] }}"><span>External digital facsimile link</span></a>
</div>
{% endif %}
{% if 'DigitalFacsimileExternalLink2' in x %}
<div>
<a target="_blank" href="{{ x['DigitalFacsimileExternalLink2']['value'] }}"><img src="{{ url_for('static', filename='/imgs/Icons/icn_external_link.svg') }}"></a>
<span>External digital facsimile link 2</span>
<a target="_blank" href="{{ x['DigitalFacsimileExternalLink2']['value'] }}"><span>External digital facsimile link 2</span></a>
</div>
{% endif %}
@ -134,21 +134,21 @@
{% if 'VideoFile' in x %}
<div>
<a target="_blank" href="{{ x['VideoFile']['value'] }}"><img src="{{ url_for('static', filename='/imgs/Icons/icn_video.svg') }}"></a>
<span>Video</span>
<a target="_blank" href="{{ x['VideoFile']['value'] }}"><span>Video</span></a>
</div>
{% endif %}
{% if 'AudioFile' in x %}
<div>
<a target="_blank" href="{{ x['AudioFile']['value'] }}"><img src="{{ url_for('static', filename='/imgs/Icons/icn_audio.svg') }}"></a>
<span>Audio</span>
<a target="_blank" href="{{ x['AudioFile']['value'] }}"><span>Audio</span></a>
</div>
{% endif %}
{% if 'ImageFile' in x %}
<div>
<a target="_blank" href="{{ x['ImageFile']['value'] }}"><img src="{{ url_for('static', filename='/imgs/Icons/icn_image.svg') }}"></a>
<span>Image</span>
<a target="_blank" href="{{ x['ImageFile']['value'] }}"><span>Image</span></a>
</div>
{% endif %}
@ -267,10 +267,13 @@
<!-- description -->
<!-- if there is a description add description here -->
<p class="label-item">DESCRIPTION</p>
{% if artworkdescriptiondata['results']['bindings']==[] %}
<p>information not available</p>
{% else %}
<p class="label-item">DESCRIPTION</p>
<!-- For loop -->
{% for x in artworkdescriptiondata['results']['bindings'] %}
@ -309,11 +312,12 @@
<!-- end description loop -->
<!-- exhibition and distribution history loop-->
<p class="label-item">EXHIBITION AND DISTRIBUTION HISTORY</p>
<!-- if exhibition in, then do show that -->
{% if artworkexhibitiondata['results']['bindings']==[] %}
<p>information not available</p>
{% else %}
<p class="label-item">EXHIBITION AND DISTRIBUTION HISTORY</p>
{% for x in artworkexhibitiondata['results']['bindings'] %}
<div class="artwork-rightcolumn-exhibition">
@ -362,37 +366,6 @@
</div>
<!-- END OF ABOUT -->
<!-- LISTS DESIGN IF NO LISTS TO BE CLARIFIED-->
<div class="artwork-lists">
<div class="Heading_C">LISTS</div>
{% if artworklists['results']['bindings']==[] %}
<p>The artwork isn't featured in any lists yet</p>
{% else %}
<p>This artwork is featured in the following lists: </p>
{% for x in artworklists['results']['bindings'] %}
<div>
<div class="artwork-lists-img">
{% if "image" in x %}
<img src="x['image']['value']">
{% else %}
<img src="{{ url_for('static', filename='/imgs/Icons/placeholder_no-image2.png') }}">
{% endif %}
</div>
<div class="artwork-lists-title">
{% if "listLabel" in x %}
{{ x['listLabel']['value'] }}
{% endif %}
</div>
<div class="artwork-lists-works-number">
placeholder for number of artworks in list
</div>
</div>
{% endfor %}
{% endif %}
</div>
<!-- END OF LISTS -->
<!-- copies in collections -->
@ -460,6 +433,36 @@
</div>
<!-- End related works -->
<!-- LISTS DESIGN IF NO LISTS TO BE CLARIFIED-->
<div class="artwork-lists">
<div class="Heading_C">LISTS</div>
{% if artworklists['results']['bindings']==[] %}
{% else %}
{% for x in artworklists['results']['bindings'] %}
<div>
<div class="artwork-lists-img">
{% if "image" in x %}
<img src="x['image']['value']">
{% else %}
<img src="{{ url_for('static', filename='/imgs/Icons/placeholder_no-image2.png') }}">
{% endif %}
</div>
<div class="artwork-lists-title">
{% if "listLabel" in x %}
<a target="_blank" href="{{ x['list']['value'] }}">{{ x['listLabel']['value'] }}</a>
{% endif %}
</div>
</div>
{% endfor %}
{% endif %}
</div>
<!-- END OF LISTS -->
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/min/tiny-slider.js"></script>

2
templates/home.html

@ -34,7 +34,7 @@
<video preload="meta" autoplay="" loop="">
<source src="{{ url_for('static', filename='/vid/DAAP_video_reduced.mp4') }}" type="video/mp4">
</video>
<a class="metadata-link" href="https://query.daap.bannerrepeater.org/embed.html#%23defaultView%3AGraph%0ASELECT%20%3Fwork%20%3FworkLabel%20%3Fimage_on_Commons%20%3Fplace_of_publication%20%3Fplace_of_publicationLabel%20%3Fcreator_of%20%3Fcreator_ofLabel%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%20%20%3Fwork%20wdt%3AP9%20wd%3AQ421.%0A%20%20OPTIONAL%20%7B%20%3Fwork%20wdt%3AP31%20%3Fimage_on_Commons.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fwork%20wdt%3AP12%20%3Fplace_of_publication.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fwork%20wdt%3AP9%20%3Fcreator_of.%20%7D%0A%7D%0ALIMIT%20100">Explore Data Visualization</a>
<a class="metadata-link" target="_blank" href="https://query.daap.bannerrepeater.org/embed.html#%23defaultView%3AGraph%0ASELECT%20%3Fwork%20%3FworkLabel%20%3Fimage_on_Commons%20%3Fplace_of_publication%20%3Fplace_of_publicationLabel%20%3Fcreator_of%20%3Fcreator_ofLabel%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%20%20%3Fwork%20wdt%3AP9%20wd%3AQ421.%0A%20%20OPTIONAL%20%7B%20%3Fwork%20wdt%3AP31%20%3Fimage_on_Commons.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fwork%20wdt%3AP12%20%3Fplace_of_publication.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fwork%20wdt%3AP9%20%3Fcreator_of.%20%7D%0A%7D%0ALIMIT%20100">Explore Data Visualization</a>
</div>
</div>

Loading…
Cancel
Save