B2 · Episode 9 · 5:03
How to Use Wikidata Creatively
This episode explains how to query Wikidata using SPARQL: filtering elements by properties and qualifiers (e.g., 'UNESCO World Heritage site' in 'Africa'), then displaying results as tables, maps, timelines, or bubble charts—and sharing them via static files or dynamic, self-updating links.
Source:Nassima Chahboun / Wikimedia Commons · License:CC BY-SA 4.0
Transcript
Et comment ça marche?
So, how does it actually work?
Par exemple, je suis architecte,
For example, I’m an architect,
je n'ai rien à voir avec le domaine du développement de l'informatique,
and I have nothing to do with the field of software development,
et c'était pour moi très difficile d'apprendre Wikidata au début,
so learning Wikidata was very difficult for me at first,
mais si je suis arrivée à le faire, tout le monde peut y arriver.
but if I managed to learn it, anyone can too.
Et donc pour apprendre la logique de construire une query sur SPARQL,
So, to learn the logic of building a query in SPARQL,
sur le Wikidata Query Service, on doit
that is, on the Wikidata Query Service,
se rappeler toujours comment Wikidata fonctionne.
we must always remember how Wikidata works.
En fait, Wikidata décrit tous les éléments à travers les déclarations,
In fact, Wikidata describes all items through statements,
propriétés qualitatives.
which consist of properties and qualitative values.
Par exemple, on a pour une ville africaine, continent Afrique,
For instance, for an African city, its continent is Africa,
nature ville, pour une personne, pour un écrivain par exemple,
and its type is ‘city’; for a person—say, a writer—
on aura fonction écrivain, lieu de naissance Abidjan par exemple.
their occupation is ‘writer’, and their place of birth is Abidjan, for example.
Donc on a toujours cette structure.
So this structure is always present.
qui est propriété qualitative.
Namely, the structure of ‘property + qualitative value’.
Et quand on essaie d'interroger, to query, Wikidata,
And when we try to query Wikidata,
qu'est- ce qu'on fait au juste? C'est,
what exactly are we doing?
on demande deux types d'informations.
We’re essentially requesting two types of information.
Tout d'abord, on demande de sélectionner tous les éléments qui répondent à certains
First, we ask to select all items that meet certain criteria—
critères, qui ont ces qualitatifs pour ces propriétés.
that is, items possessing these specific properties and their qualitative values.
Par exemple, on veut sélectionner tous les éléments sur Wikidata qui ont la nature
For example, we want to select all items on Wikidata whose type is ‘city’ and location is Paris,
ville et la ville Paris, pour sélectionner
or whose type is ‘church’ and location is Paris,
la nature église et la ville Paris,
in order to identify all churches located in Paris.
pour sélectionner toutes les églises qui existent sur Paris.
(Note: The original sentence is already complete; no addition needed.)
Puis on demande quelle information on veut afficher.
Then, we specify which information we want to display.
Par exemple, on veut afficher les images de ces villes et on veut afficher les
For example, we want to display images of these cities and also display
coordonnées géographiques.
their geographic coordinates.
Donc il faut toujours se rappeler de ces deux éléments de la query,
So, we must always remember these two elements of the query:
c'est quels sont les critères,
first, what criteria we’ll use to filter the information;
à travers lesquelles on veut filtrer l'information,
second, the information we want to retrieve based on those criteria;
ensuite quels sont les éléments qu'on veut afficher pour
and third, which specific items we want to display for
ces éléments. Et voici l'interface de Wikidata Query Service,
these items. Here is the Wikidata Query Service interface,
comme je pense que vous l'avez déjà tous utilisé ou au moins vu.
which I believe you’ve all either used before or at least seen.
Donc sur le Query Service, on a deux parties.
So on the Query Service, we have two parts.
La première, c'est pour écrire la query en code SPARQL,
The first part is for writing the query in SPARQL code,
mais la deuxième partie à gauche,
while the second part on the left,
c'est le Query Helper qui est très très utile pour les personnes qui ne savent pas
is the Query Helper—which is extremely helpful for people who don’t know
comment écrire en SPARQL.
how to write in SPARQL.
Et donc dans le Query Helper, on peut déjà trouver deux types de demandes,
So, in the Query Helper, we can already find two types of requests:
c'est filtrer, ensuite show, afficher.
one is filtering, and the other is showing.
Et donc sur la partie filtrer, on peut écrire toutes les
So, in the filter section, we can enter all the
propriétés et qualitatifs qu'on veut obtenir.
properties and qualitative features we want to obtain.
Ensuite pour la partie show ou afficher, on
Next, in the 'show' or 'display' section, we
met les éléments qu'on veut afficher.
place the elements we want to display.
Et ici on a un exemple, par exemple on veut tous les éléments qui ont le statut
Here's an example: for instance, we want all the elements that have the
patrimonial mondial de l'UNESCO.
UNESCO World Heritage status.
Dans tous les pays positionnés dans le continent africain,
All countries located on the African continent,
donc on veut les sites du patrimoine mondial africain,
so we wanted African World Heritage sites,
et on veut que ce soit des régions urbaines, des villes, des quartiers,
specifically urban areas, cities, or neighborhoods, etc.
etc. Et c'était la query qui a été faite pour faire sortir le diagramme à bulles
This was the query used to generate the bubble chart we just saw.
qu'on a vu tout à l'heure.
(which we just saw)
Et ensuite, on peut ici écrire ORDER BY DESC area, par exemple,
Then, we can write here "ORDER BY DESC area", for example,
si on veut les classer par ordre croissant ou décroissant.
if we want to sort them in ascending or descending order.
On choisit quel ordre on veut suivre.
We choose which sorting order we want to follow.
Ensuite, on choisit quel élément ou quel critère
Next, we choose
sur lequel se base cet ordre.
the field or criterion on which this ordering is based.
Ici, c'est la superficie.
Here, it’s the area.
Et donc maintenant on a notre query qui a été écrite, on l'a démarrée,
So now our query has been written and executed,
on a obtenu nos résultats.
and we’ve obtained our results.
Qu'est- ce qu'on va faire avec ces résultats?
So what will we do with these results?
On peut tout d'abord choisir
We can first choose
le mode d'affichage.
the display mode.
Est- ce que je veux un simple tableau, ou bien je veux une carte,
For instance: do I want a simple table, or rather a map,
une timeline, ou différents types de diagrammes.
a timeline, or various types of charts?
Ensuite, pour communiquer ces résultats, j'ai plusieurs options.
Next, to share these results, I have several options.
Je peux tout d'abord télécharger les résultats en
I can first download the results as
tableau HTML, en fichier CSV, JSON file,
an HTML table, a CSV file, a JSON file,
en image par exemple si je veux obtenir une image d'une carte et la
or an image—for example, if I want an image of a map,
publier n'importe où, bien l'insérer dans un site web par exemple.
and publish it anywhere, such as embedding it into a website.
Mais l'image reste un résultat statique.
However, an image remains a static result.
Ensuite, je peux obtenir un lien qui va me mener directement vers le résultat de la
Next, I can obtain a direct link
query. Et ce qui est bien avec le lien, c'est que c'est très simple à générer,
that takes me straight to the query’s results page. The advantage of this link is that it’s very easy to generate,
je n'ai pas besoin d'ajouter ou de faire quelque chose d'autre.
and I don’t need to add or do anything else.
Et si par exemple un élément qui s'ajoute sur Wikidata ou bien qui est actualisé sur
Moreover, if an item is added to Wikidata—or updated on Wikidata—
Wikidata, le résultat sera directement actualisé à travers ce lien.
the results accessed via this link will update automatically in real time.