How to get all values ​​of the Wikidata element's Labels property?

How do you request a set of all the properties that an element has?

In particular, I am looking for English labels for each element, which is the value of the property of the element.

eg. " Earth ":

{
    "Challenger Deep",
    "Solar System",
    "oblate spheroid",
    "geoid",
    "World Ocean",
    "Afro-Eurasia",
    ...
}

I am currently using the Wikidata Toolkit library, but I would accept the recommendations.

+4
source share
1 answer

First you need to use the MediaWiki API with the wbgetclaims action to get all the properties for each application. For example, for a Wikidata Earth (Q2) element, the query would be:

https://www.wikidata.org/w/api.php?action=wbgetclaims&format=xml&props=value&entity=Q2

id value property. P1589 Q459173.

- . , ids , |:

: , , . , links, namespace 0, Q.

https://www.wikidata.org/w/api.php?action=query&titles=Q2&generator=links&gplnamespace=0&gpllimit=100&prop=pageterms&wbptterms=label
+4

Source: https://habr.com/ru/post/1624469/


All Articles