1

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?

OmniOwl
  • 5,477
  • 17
  • 67
  • 116

1 Answers1

1

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".

Ainali
  • 1,613
  • 13
  • 23
  • So for every game (all 22,000) I'd have to make these individual queries first getting the value, then getting their individual labels? Is there some smarter way of doing this? That could take days and probably stress the API a lot Lol – OmniOwl Mar 25 '17 at 22:51
  • Well, you can send in 50 id:s at a time (500 if you get a bot account, if you want to do this frequently) like this: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q206855|Q728061&languages=en&props=labels See documentation here: https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities – Ainali Mar 25 '17 at 23:03
  • It's more a one time thing for the set of data I'm currently working on. I might get more sets in the future like movies, or books, and things like that. – OmniOwl Mar 25 '17 at 23:05