-
Notifications
You must be signed in to change notification settings - Fork 7
Using Wikidata Query Service
Louis Maddox edited this page Feb 10, 2021
·
2 revisions
Wikidata has a query service with examples like cats, with pictures
#Cats, with pictures
#defaultView:ImageGrid
SELECT ?item ?itemLabel ?pic
WHERE
{
?item wdt:P31 wd:Q146 .
?item wdt:P18 ?pic
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
The first line is read as 4 components:
-
?item
means -
wdt:P31
means “instance of” -
wd:Q146 .
means -
wdt:P18
means
The first step to finding images I want is to go backwards and inspect the properties of an image found already (from the Commons: Featured pictures link above)
- An example of such a picture is Scheme of a submarine eruption
- This is a SVG but every SVG has a PNG (e.g. here it's this 1080x1080px PNG)
- Clicking "More details" gives the details page
- The property for a Wikimedia Commons featured picture is
Q63348049