wikipediawikidata-api

Wikidata values and properties given a Unique Identifier?


I am not quite sure how to do this but I have 22,000 unique identifiers for game titles from Wikipedia. I got them through their Public API but now I'm stuck.

I need to use those identifiers to get all the properties for each article they point to. I have a file that holds all the different Property identifiers (like P143 meaning "Imported From") so I can translate those into strings. But what I can't seem to figure out is how to get the values for those properties. I just get new Unique Identifiers.

Here is a Query I tried which should get you Duke Nukem 3D in English only. Here is a snippet from that query:

"P143": [
    {
        "snaktype": "value",
        "property": "P143",
        "datavalue": {
            "value": {
                "entity-type": "item",
                "numeric-id": 206855,
                "id": "Q206855"
            },
            "type": "wikibase-entityid"
        },
        "datatype": "wikibase-item"
    }
]

I can't really understand how I'm supposed to get the Value this property represents from this. If anyone could be of assistance I'd really appreciate it.

How do I get the values from these Properties?


Solution

  • You are close, but there is one thing that you are missing. What you call a value is what Wikidata call the label of an item (item being the Q-number returned in the query). So you are actually getting the value, but need to do a new query for the label. For example, in the query you made, quite close to the top, there is a section called "labels" (and you can see that your query returns the label for "Duke Nukem 3D"). That would be the "value" you are looking for. If you insert the Q-number from your snippet it will reveal that it is the "Russian language edition of Wikipedia".