Skip to content

All properties of an entity #53

Answered by dahlia
2213500360 asked this question in Q&A
Discussion options

You must be logged in to vote

FYI Entity implements Mapping[EntityId, object], which means it's okay to expect Entity can do almost everything dict can do.

>>> from wikidata.client import Client
>>> entity = client.get("Q107365", load=True)
>>> props = list(entity.keys())[:10]  # List only 10 properties in this demo session
>>> for prop in props: prop.load()  # Load all property labels so that we can inspect them easily
...
>>> props
[<wikidata.entity.Entity P1469 'FIFA player ID (archived)'>,
 <wikidata.entity.Entity P413 'position played on team / speciality'>,
 <wikidata.entity.Entity P21 'sex or gender'>,
 <wikidata.entity.Entity P106 'occupation'>,
 <wikidata.entity.Entity P54 'member of sports team'>,
 <wikidata…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dahlia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #37 on November 15, 2022 05:34.