Show existing depicts on browse page

This commit is contained in:
Edward Betts 2019-11-25 15:46:05 +00:00
parent a2aa063dd5
commit 2cbc88a947
3 changed files with 31 additions and 4 deletions

View file

@ -56,6 +56,11 @@
<h5 class="card-title">{{ item.label }}</h5>
<p class="card-text">by {{ item.artist_name }}
{% if item.date %}({{ item.date }}){% endif %}
<div>
{% for depicts_label in item.depicts %}
<span class="badge badge-primary">{{ depicts_label }}</span>
{% endfor %}
</div>
</p>
</div>
</div>

View file

@ -1,6 +1,16 @@
select ?item ?itemLabel ?image ?artist ?artistLabel ?title ?titleLang ?time ?timeprecision {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?isa { {% for isa in isa_list %} wd:{{ isa }} {% endfor %} }
select ?item
?itemLabel
?image
?artist
?artistLabel
?title
?titleLang
?time
?timeprecision
(group_concat(distinct ?depictsLabel; SEPARATOR="|") as ?depictsList)
where {
service wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
values ?isa { {% for isa in isa_list %} wd:{{ isa }} {% endfor %} }
?item wdt:P31 ?isa .
{% for pid, qid in params %}
@ -17,4 +27,10 @@ select ?item ?itemLabel ?image ?artist ?artistLabel ?title ?titleLang ?time ?tim
BIND(LANG(?title) as ?titleLang)
}
OPTIONAL { ?item wdt:P170 ?artist }
}
OPTIONAL {
?item wdt:P180 ?depicts .
?depicts rdfs:label ?depictsLabel .
FILTER(LANG(?depictsLabel) = "en").
}
} group by ?item ?itemLabel ?image ?artist ?artistLabel
?title ?titleLang ?time ?timeprecision