All properties of an entity #53
-
As in title,can I get all properties of an entity?Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
for the record, I've just did this. In [49]: data = client.get("Q107365", load=True)
In [50]: attrs = [client.get(attribute) for attribute in data.attributes.get('claims').keys()]
In [51]: {attr.label["en"]: data[attr] for attr in attrs}
Out [51]:
{'FIFA player ID (archived)': '228912',
'position played on team / speciality': <wikidata.entity.Entity Q201330>,
'sex or gender': <wikidata.entity.Entity Q6581097>,
'occupation': <wikidata.entity.Entity Q937857>,
'member of sports team': <wikidata.entity.Entity Q15789>,
'place of birth': <wikidata.entity.Entity Q2765>,
'award received': <wikidata.entity.Entity Q311830>,
'country of citizenship': <wikidata.entity.Entity Q183>,
'VIAF ID': '11051079',
'Commons category': 'Manuel Neuer',
'GND ID': '133960692',
'date of birth': datetime.date(1986, 3, 27),
'instance of': <wikidata.entity.Entity Q5>,
'official website': 'http://www.manuel-neuer.de/',
'Freebase ID': '/m/02899ft',
'given name': <wikidata.entity.Entity Q11113719>,
'sport': <wikidata.entity.Entity Q2736>,
'sport number': '1',
'participant in': <wikidata.entity.Entity Q79859>,
'Munzinger Sport number': '01000007267',
'WorldFootball.net player ID': 'manuel-neuer',
'languages spoken, written or signed': <wikidata.entity.Entity Q188>,
'GTAA ID': '229126',
'Twitter username': 'Manuel_Neuer',
'IMDb ID': 'nm2568047',
'Commons gallery': 'Manuel Neuer',
'UEFA player ID': '97923',
'residence': <wikidata.entity.Entity Q2765>,
'educated at': <wikidata.entity.Entity Q674057>,
'Transfermarkt player ID': '17259',
'National-Football-Teams.com player ID': '31465',
'Mackolik.com player ID': '22992',
'mass': wikidata.quantity.Quantity(92.0, None, None, <wikidata.entity.Entity Q11570>),
'height': wikidata.quantity.Quantity(193.0, None, None, <wikidata.entity.Entity Q174728>),
'Facebook ID': 'manuel.neuer',
'Fussballdaten.de player ID': 'neuermanuel',
'ISNI': '0000 0000 1801 0937',
'ESPNFC.com player ID': '84774',
'FootballDatabase.eu player ID': '14274',
'AS.com athlete ID': 'neuer/15383',
'family name': <wikidata.entity.Entity Q16864501>,
'Quora topic ID': 'Manuel-Neuer-football-player',
'NE.se ID': 'manuel-neuer',
'league': <wikidata.entity.Entity Q82595>,
'Instagram username': 'manuelneuer',
'birth name': '(de:) Manuel Peter Neuer'[6:],
'Encyclopædia Britannica Online ID': 'biography/Manuel-Peter-Neuer',
'Great Russian Encyclopedia Online ID': '3355149',
'country for sport': <wikidata.entity.Entity Q183>,
'name in native language': '(de:) Manuel Neuer'[6:],
'Soccerway player ID': 'manuel-neuer/1970',
"topic's main category": <wikidata.entity.Entity Q55245201>,
'image': <wikidata.commonsmedia.File 'File:Manuel Neuer Germany Austria June 2018.jpg'>,
'NKCR AUT ID': 'xx0222396',
'Giant Bomb ID': '3005-38099',
'work period (start)': 2004,
'PlaymakerStats.com player ID': '29193',
'München Wiki article ID': 'Manuel_Neuer',
'Brockhaus Enzyklopädie online ID': 'neuer-manuel',
'Store norske leksikon ID': 'Manuel_Neuer',
'WorldCat Identities ID': 'viaf-11051079',
'number of matches played/races/starts': wikidata.quantity.Quantity(2.0, None, None, None),
'total goals in career': wikidata.quantity.Quantity(0.0, None, None, None),
'number of points/goals conceded': wikidata.quantity.Quantity(3.0, None, None, None),
'German Football Association person ID': '10435',
'Kicker.de player ID (former scheme)': '30669',
'EU-Football.info player ID': '26616',
'BDFA player ID': '61366',
"L'Équipe football player ID": '22939',
'So Foot ID': 'manuel-neuer',
'Kicker.de player ID (actual scheme)': 'manuel-neuer',
'PLWABN ID': '9810576374305606',
'NLP ID (old)': 'A29775620',
'social media followers': wikidata.quantity.Quantity(3961870.0, None, None, None),
'Klexikon article ID': 'Manuel_Neuer',
'FBref player ID': '8778c910',
'BDFutbol player ID': '92643',
'Soccerbase player ID': '44916',
'Kooora/Goalzz player ID': '25931',
'TMDB person ID': '1146750',
'Trading Card Database person ID': '34836',
'Deutsche Synchronkartei dubbing voice actor ID': '6297',
'Library of Congress authority ID': 'no2020073207',
'NDL Authority ID': '001255681',
'Personality Database profile ID': '6749',
'Golden ID': 'Manuel_Neuer-KWN6G8'} |
Beta Was this translation helpful? Give feedback.
-
FYI >>> 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.entity.Entity P19 'place of birth'>,
<wikidata.entity.Entity P166 'award received'>,
<wikidata.entity.Entity P27 'country of citizenship'>,
<wikidata.entity.Entity P214 'VIAF ID'>,
<wikidata.entity.Entity P373 'Commons category'>] Indices also work: >>> (props[0], entity[props[0]])
(<wikidata.entity.Entity P1469 'FIFA player ID (archived)'>, '228912')
>>> (props[1], entity[props[1]])
(<wikidata.entity.Entity P413 'position played on team / speciality'>, <wikidata.entity.Entity Q201330 'goalkeeper'>)
>>> (props[4], entity[props[4]])
(<wikidata.entity.Entity P54 'member of sports team'>, <wikidata.entity.Entity Q15789 'FC Bayern Munich'>) Note that each property can be associated with multiple objects. Under the hood, >>> teams = entity.getlist(props[4])
>>> for team in teams: team.load()
...
>>> teams
[<wikidata.entity.Entity Q15789 'FC Bayern Munich'>,
<wikidata.entity.Entity Q3736767 'FC Schalke 04 II'>,
<wikidata.entity.Entity Q32494 'FC Schalke 04'>,
<wikidata.entity.Entity Q43310 'Germany national association football team'>,
<wikidata.entity.Entity Q314851 'Germany national under-21 football team'>,
<wikidata.entity.Entity Q2016992 'Germany national under-18 football team'>,
<wikidata.entity.Entity Q324854 'Germany national under-19 football team'>,
<wikidata.entity.Entity Q316497 'Germany national under-20 football team'>] |
Beta Was this translation helpful? Give feedback.
FYI
Entity
implementsMapping[EntityId, object]
, which means it's okay to expectEntity
can do almost everythingdict
can do.