Closed JiyaoWei closed 3 years ago
If you mean by the P31
property:
>>> from wikidata.client import Client
>>> client = Client()
>>> e = client.get('Q28865', load=True)
>>> e
<wikidata.entity.Entity Q28865 'Python'>
>>> instance_of = client.get('P31', load=True)
>>> instance_of
<wikidata.entity.Entity P31 'instance of'>
>>> types = e.getlist(instance_of)
>>> types
[<wikidata.entity.Entity Q899523>, <wikidata.entity.Entity Q1268980>, <wikidata.entity.Entity Q3839507>, <wikidata.entity.Entity Q187432>, <wikidata.entity.Entity Q12772052>, <wikidata.entity.Entity Q21562092>, <wikidata.entity.Entity Q1993334>, <wikidata.entity.Entity Q211496>, <wikidata.entity.Entity Q9143>, <wikidata.entity.Entity Q1004415>]
>>> for t in types:
... t.load()
...
>>> types
[<wikidata.entity.Entity Q899523 'object-based language'>, <wikidata.entity.Entity Q1268980 'dynamic programming language'>, <wikidata.entity.Entity Q3839507 'functional programming language'>, <wikidata.entity.Entity Q187432 'scripting language'>, <wikidata.entity.Entity Q12772052 'multi-paradigm programming language'>, <wikidata.entity.Entity Q21562092 'imperative programming language'>, <wikidata.entity.Entity Q1993334 'interpreted language'>, <wikidata.entity.Entity Q211496 'high-level programming language'>, <wikidata.entity.Entity Q9143 'programming language'>, <wikidata.entity.Entity Q1004415 'run-time system'>]
How to get instance_of information?