eldur/jwbf

Get wikidata page ID for a wikipedia page

GitTom opened this issue · 7 comments

I notice that there has been some discussion about adding some wikidata query functionality to jwbf:
Wikidata/Wikidata-Toolkit#11

I think that sounds great, but I thought I should note that the existing jwbf API doesn't support getting the wikidata page id - which I think is the essential link between the two.

That id is displayed rather prominently in the page info of very wiki page, but I actually don't even know how to retrieve it via the mediawiki API (I don't see a prop for it). Assuming that there is a way, and I'm just missing it, I think it would be appropriate to add that to jwbf when adding wikidata support.

Otherwise one is stuck using dbpedia, or probably the wikidata API has a way to translate a wikipedia id (plus language) into its own page id - but that would have to be inefficient.

I assume it is better to ask at Wikidata-Toolkit or mediawikis api mailinglist for "How to get an itemid of a given wikipedia lemma?" or "How to map a given lemma to an itemid?"

Ok, apparently wikidata page id can be retrieved for a wikipedia page like this:

https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&prop=pageprops&ppprop=wikibase_item&titles=Roy%20Dowling&format=json

So it could be added to any query, e.g. here a category query:
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Culture&gcmnamespace=0&format=jsonfm&gcmlimit=max&prop=pageprops&ppprop=wikibase_item

You can close this (unless you think this functionality should be explicitly added to JWBF).

Thanks for your investigation, I've started a experimental branch with wikidata support.

See also #9

Would you consider making that branch public? I'd like to contribute to it if possible.

It is public, Wikidata Branch, but a few commits behind the master and fast forwarded to master (rebase) by me (merging may be difficult, if you use this branch directly; better cherry-pick this change).

Ok, then if I'm working on it should I just make a branch off of master and send pull requests from there?

Sounds good. I suggest we'll see what works best if you send a request.