
Kate (Q1252986310)and Ravi (Q135189340) are good friends with Dr Susan (0000-0001-9554-4948), who is our next-door neighbour here in Richmond (Q61359147). Our lives occasionally intersect at birthday parties or tea. Their two gals also went to Parktown High School for Girls (Q7138735), like my two.
None of these identifiers are as memorable as that of Q1001 (Mahatma Gandhi). However, if you visit any Wikidata identifier, you can verify that they say who they are by either viewing their references. Or by using other identifiers, like Susan’s Orcid. You can see that we are a clutch of academics, journalists and activists.
These identifiers will also allow you to display a family tree (if the data is there). Want to show the links between father (P22), mother (P25), parent (P8810) and child (P40). Visit GeneaWiki https://magnus-toolserver.toolforge.org/ts2/geneawiki/ and enter Gandhi’s tripple identifier (Q1001). You will see the family tree in another format. Want to understand what’s going on behind the scenes? That’s where we start asking questions.
The linked data stored on the centralised data repository (Wikidata) is being used to construct a family chart, or tree. Another term for this arrangement of real-world entities is a “semantic network“. All Wikimedia projects have the option to draw their information from this central place and construct a structure that encodes and represents knowledge. The infobox you see on a Wikipedia article is a neat way to present the basic facts of an article. That infobox might be filled with information presented on the page. Or the data could be pulled from Wikidata to create a knowledge graph (Q33002955). And this can be done in multiple languages.
Now this is Mike’s (Q26207216) lovely infobox work, and his handy tutorial. It’s how you can create a knowledge graph (I think). Here in South Africa (Q258), I have seen this Wikidata infobox in action on Afrikaans Wikipedia called {{databoks}}, on the siSwati Wikipedia called{{umuntfu}} and the Xitsonga Wikipedia called {{Bio}} The vernacular versions are undocumented. Pity. To quote an administrator: “Dit is ‘n gemors.” Oesjaar is keeping growing the af community. Credit to him.
As I become familiar with Wikidata, I think it’s necessary to learn how to query Wikidata directly for results. Instead of going through third-party code, use a language known as SPARQL (Q54871). I’m not going to try to create an infobox. I’m going to write a query (and credit to Emre Yüksel for his fine tutorial) that will draw on Wikidata to begin to show Ravi and Kate’s family tree (they asked me to assist in this matter).
My task is to find the parents of Ravi. I’ll express this first in non-SPARQL terms.
SELECT ? parent
WHERE
{
?parent child Ravi
}
I’ll use two or two identifiers in my query
Then these prefixes will be added
- Properties get prefixed with
wdt: - Identifiers are prefixed with
wd:.
Let’s combine these identifier properties and prefixes into our SPARQL query.
#find the parents of (Q135189340)
SELECT ?parent
WHERE
{
?parent wdt:P40 wd:Q135189340
} https://w.wiki/F7oJ
Now, let me not deceive myself. This query seems pretty basic, and yet it has taken me a whole day to get it working smoothly. There are also many things I can’t figure out. For example, I’d actually like to express the names in the result. But I can’t quite get that right either.
SELECT ?father ?fatherLabel
WHERE
{
wd:Q135189340 wdt:P22 ?father
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
The output that I get from https://query.wikidata.org/ is just another number.
| father | fatherLabel |
|---|---|
| http://www.wikidata.org/entity/Q131561818 | Q131561818 |
That’s enough open thinking for the day. Please note that this is by no means definitive. I’m sure there are many mistakes.
Finally, a quick apology again for the weird technical glitch on Friday. I’m not sure what happened, but I’ve deleted the post.