What is the Wikidata API equivalent to this page which lists all known Wikidata properties? I would like to search for a property, e.g. 'doctoral advisor', and get back P184.
A similar function exists for items, but I can't seem to find the equivalent for properties.
Using action=wbsearchentities
with type=property
should do. Wikidata API doc is here, search for "=wb" to get the Wikidata-specific functions.
Update: thank to @nerab's answer, I updated wikidata-properties-dumper to use Quarry SQL results: that's indead much cleaner :)
Update 2: Quarry wasn't that flexible, I moved to use a SPARQL query and wrapped that in a Wikidata CLI command: wd props
I wrote a small script to query all properties with wikidata API's action=wbgetentities. It generate a json file with
key: value
being
property Pid: property label in the request language
I published the outputs for a few languages and could do for other language on request until there is an official (and cleaner) answer for this need
Thanks to the comments in @maxlath's project, I found Quarry.
A list of all Wikidata properties can be fetched from
http://quarry.wmflabs.org/run/45013/output/1/json
This particular list is in English, but the query can be modified for other languages, too.
You can use this SPARQL query: it returns property name, description and comma separated also known as labels from English language:
SELECT ?property ?propertyLabel ?propertyDescription (GROUP_CONCAT(DISTINCT(?altLabel); separator = ", ") AS ?altLabel_list) WHERE {
?property a wikibase:Property .
OPTIONAL { ?property skos:altLabel ?altLabel . FILTER (lang(?altLabel) = "en") }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .}
}
GROUP BY ?property ?propertyLabel ?propertyDescription
LIMIT 5000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With