I'm following the MWAPI docs (https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual/MWAPI#Find_all_entities_with_labels_%22cheese%22_and_get_their_types) and have the following query:
SELECT * WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "www.wikidata.org";
wikibase:api "EntitySearch";
mwapi:search "python";
mwapi:language "en".
?item wikibase:apiOutputItem mwapi:item.
?label wikibase:apiOutputItem mwapi:label.
?num wikibase:apiOrdinal true.
}
}
ORDER BY ASC(?num) LIMIT 10
I also want to retrieve the description of the wikidata item but don't know how to get it. I've tried adding the following line ?description wikibase:apiOutputItem mwapi:description
but it seems to be an invalid property on the API. How do I retrieve it and where can I find this in the docs?
The wikibase:label
service provides both the label and the description of an item for a specified language. Both have to be explicitly queried for in the SELECT
part:
SELECT ?item ?itemLabel ?itemDescription ?num WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "www.wikidata.org";
wikibase:api "EntitySearch";
mwapi:search "python";
mwapi:language "en".
?item wikibase:apiOutputItem mwapi:item.
?num wikibase:apiOrdinal true.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ASC(?num) LIMIT 10