Closed junyang-cynopsis closed 5 years ago
Sorry, I didn't properly understand your question. To me, your code should work. In the below example, isn't Q30
(United States of America
) the answer you want?
>>> from wikidata.client import Client
>>> client = Client()
>>> mj = client.get('Q2831', load=True)
>>> mj
<wikidata.entity.Entity Q2831 'Michael Jackson'>
>>> nationality_prop = client.get('P27', load=True)
>>> nationality_prop
<wikidata.entity.Entity P27 'country of citizenship'>
>>> mj_nationality = mj[nationality_prop]
>>> mj_nationality.load()
>>> mj_nationality
<wikidata.entity.Entity Q30 'United States of America'>
Hi, is there any way to retrieve an entity's property's name? eg.
I would like to retrieve entity's country of citizenship's value instead of description