Bug fix missing datavalue.

This commit is contained in:
Edward Betts 2019-09-29 19:24:24 +01:00
parent 9acbefc105
commit 146b79bde8

8
app.py
View file

@ -72,8 +72,7 @@ select ?item ?itemLabel ?image ?artist ?artistLabel ?title ?time ?timeprecision
'''
find_more_basic_query = '''
select ?item ?itemLabel ?image ?artist {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
select distinct ?item ?image {
VALUES ?value { LIST }
?item wdt:P31 wd:Q3305213 .
?item wdt:PID ?value .
@ -570,6 +569,8 @@ def next_page(item_id):
values = []
for claim in claims:
if 'datavalue' not in claim['mainsnak']:
continue
value = claim['mainsnak']['datavalue']['value']
claim_qid = value['id']
numeric_id = value['numeric-id']
@ -580,6 +581,9 @@ def next_page(item_id):
'label': other.get(claim_qid),
})
if not values:
continue
qid_list = [v['qid'] for v in values]
other_list.append({