diff --git a/depicts/wikibase.py b/depicts/wikibase.py index cd29195..28389e5 100644 --- a/depicts/wikibase.py +++ b/depicts/wikibase.py @@ -1,6 +1,8 @@ def first_datavalue(entity, pid): 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): if 'en' in entity['labels']: