A graph database organizes facts as entities connected by relationships, making questions about linked information natural to query. Graph-oriented languages include SPARQL, Cypher, and AQL. section 11.9
Wikidata provides a concrete graph: entities use Q-IDs, relationships use property P-IDs, and SPARQL retrieves connected facts across many entities. Its graph contains more than 100 million data items. section 11.9
Finding coauthors through connected facts
A SPARQL query can start with Timnit Gebru, find a notable scholarly article, and follow its author property to retrieve Timnit Gebru, Margaret Mitchell, and Emily M. Bender. section 11.9
>>> def get_wikidata_qid(wikiarticle, wikisite="enwiki"):
... WIKIDATA_URL='https://www.wikidata.org/w/api.php'
... resp = requests.get(WIKIDATA_URL, timeout=5, params={
... 'action': 'wbgetentities',
... 'titles': wikiarticle,
... 'sites': wikisite,
... 'props': '',
... 'format': 'json'
... }).json()
... return list(resp['entities'])[0]
>>> tg_qid = get_wikidata_qid('Timnit Gebru')
>>> tg_qid
'Q59753117'
This Python helper resolves a Wikipedia article name to its Wikidata entity identifier, providing the starting point for graph queries. section 11.9



