diff --git a/depicts/wdqs.py b/depicts/wdqs.py
index 268f94e..c71b0b2 100644
--- a/depicts/wdqs.py
+++ b/depicts/wdqs.py
@@ -83,6 +83,7 @@ def build_browse_item_map(bindings):
item = {
'image_filename': image_filename,
'date': d,
+ 'depicts': row['depictsList']['value'].split('|'),
}
if artist_name:
item['artist_name'] = artist_name
@@ -103,6 +104,7 @@ def build_browse_item_map(bindings):
artist_names = []
labels = set()
when = None
+ depicts = []
for item in items:
if 'title' in item:
lang, title = item['title']
@@ -115,6 +117,9 @@ def build_browse_item_map(bindings):
labels.add(item['label'])
if when is None and item.get('date'):
when = item['date']
+ for d in item['depicts']:
+ if d not in depicts:
+ depicts.append(d)
item = {
'qid': f'Q{item_id}',
@@ -122,6 +127,7 @@ def build_browse_item_map(bindings):
'image_filename': list(filenames),
'artist_name': ', '.join(artist_names),
'date': when,
+ 'depicts': depicts,
}
if artist_names:
item['artist_name'] = ', '.join(artist_names)
diff --git a/templates/find_more.html b/templates/find_more.html
index a4d1480..fc5bcb4 100644
--- a/templates/find_more.html
+++ b/templates/find_more.html
@@ -56,6 +56,11 @@
{{ item.label }}
by {{ item.artist_name }}
{% if item.date %}({{ item.date }}){% endif %}
+
+ {% for depicts_label in item.depicts %}
+ {{ depicts_label }}
+ {% endfor %}
+
diff --git a/templates/query/find_more.sparql b/templates/query/find_more.sparql
index 4bc2baa..15db67f 100644
--- a/templates/query/find_more.sparql
+++ b/templates/query/find_more.sparql
@@ -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