-
How to get instance_of information? |
Beta Was this translation helpful? Give feedback.
Answered by
dahlia
Mar 31, 2021
Replies: 1 comment
-
If you mean by the >>> 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'>] |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dahlia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you mean by the
P31
property: