Bug fix missing datavalue.
This commit is contained in:
parent
9acbefc105
commit
146b79bde8
8
app.py
8
app.py
|
@ -72,8 +72,7 @@ select ?item ?itemLabel ?image ?artist ?artistLabel ?title ?time ?timeprecision
|
||||||
'''
|
'''
|
||||||
|
|
||||||
find_more_basic_query = '''
|
find_more_basic_query = '''
|
||||||
select ?item ?itemLabel ?image ?artist {
|
select distinct ?item ?image {
|
||||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
|
|
||||||
VALUES ?value { LIST }
|
VALUES ?value { LIST }
|
||||||
?item wdt:P31 wd:Q3305213 .
|
?item wdt:P31 wd:Q3305213 .
|
||||||
?item wdt:PID ?value .
|
?item wdt:PID ?value .
|
||||||
|
@ -570,6 +569,8 @@ def next_page(item_id):
|
||||||
values = []
|
values = []
|
||||||
|
|
||||||
for claim in claims:
|
for claim in claims:
|
||||||
|
if 'datavalue' not in claim['mainsnak']:
|
||||||
|
continue
|
||||||
value = claim['mainsnak']['datavalue']['value']
|
value = claim['mainsnak']['datavalue']['value']
|
||||||
claim_qid = value['id']
|
claim_qid = value['id']
|
||||||
numeric_id = value['numeric-id']
|
numeric_id = value['numeric-id']
|
||||||
|
@ -580,6 +581,9 @@ def next_page(item_id):
|
||||||
'label': other.get(claim_qid),
|
'label': other.get(claim_qid),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if not values:
|
||||||
|
continue
|
||||||
|
|
||||||
qid_list = [v['qid'] for v in values]
|
qid_list = [v['qid'] for v in values]
|
||||||
|
|
||||||
other_list.append({
|
other_list.append({
|
||||||
|
|
Loading…
Reference in a new issue