This commit is contained in:
Edward Betts 2019-10-14 19:59:58 +01:00
parent 94398524b1
commit 8a90bf5e3f

View file

@ -1,6 +1,8 @@
def first_datavalue(entity, pid): def first_datavalue(entity, pid):
if pid in entity['claims']: if pid in entity['claims']:
return entity['claims'][pid][0]['mainsnak']['datavalue']['value'] mainsnak = entity['claims'][pid][0]['mainsnak']
if 'datavalue' in mainsnak:
return mainsnak['datavalue']['value']
def get_entity_label(entity): def get_entity_label(entity):
if 'en' in entity['labels']: if 'en' in entity['labels']: