Last modified: 2012-12-13 11:22:41 UTC
This api request fails: http://www.wikidata.org/w/api.php?action=wbgetitems&props=sitelinks/urls|info&sites=hiwiki|zhwiki|euwiki|frwiki|ruwiki|eswiki|enwiki|cawiki|itwiki|dewiki|fawiki|urwiki|arwiki|svwiki|nlwiki|ptwiki|enwiki|fiwiki|dewiki&titles=%E0%A4%85%E0%A4%B0%E0%A5%8D%E0%A4%AE%E0%A4%BE%E0%A4%82%E0%A4%9F%28%E0%A4%95%E0%A5%81%E0%A4%A4%E0%A5%8D%E0%A4%A4%E0%A4%BE%29|%E8%89%BE%E7%88%BE%E6%9B%BC%E7%89%B9%7CHermontis|Hermonthis|%D0%93%D0%B5%D1%80%D0%BC%D0%BE%D0%BD%D1%82%D0%B8%D1%81%7CArmant|Hermonthis|Armant|Ermonti|Armant|%D8%A7%D8%B1%D9%85%D9%86%D8%AA%7C%D8%A7%D8%B1%D9%85%D9%86%D8%AA%7C%D8%A3%D8%B1%D9%85%D9%86%D8%AA%7CHermonthis|Armant|C%C3%A3o+Pastor+de+Armant|Armant+%28dog%29|Egyptinpaimenkoira|Armant+%28Hunderasse%29 It contains some returned values having an empty site or title <item site="enwiki" title="" missing="" /> <item site="cawiki" title="" missing="" /> <item site="dewiki" title="" missing="" /> <item site="urwiki" title="" missing="" /> <item site="" title="Hermonthis" missing="" /> but the request does not contain any "||". And not all requested sitelinks are returned: These ones are missing: http://www.wikidata.org/w/api.php?action=wbgetitems&props=sitelinks/urls|info&sites=enwiki|fiwiki|dewiki&titles=Armant+%28dog%29|Egyptinpaimenkoira|Armant+%28Hunderasse%29
This request has 19 sites and 14 titles. That will reuse the shortest array to fill the remaining entries for the sites. I'm not sure why the titles comes back empty.
I localized the actual code, and this code sequence was changed after branch 0.1 was made. I guess the old code still have a bug. The new code will cyclic reuse missing titles and sites so it is possible to write something like http://www.wikidata.org/w/api.php?action=wbgetitems&props=info&sites=enwiki&titles=Norge|Noreg|Norway|Norwegen This will try the pairs enwiki - Norge enwiki - Noreg enwiki - Norway enwiki - Norwegen and then return the found entity <?xml version="1.0"?> <api success="1"> <entities> <entity site="enwiki" title="Norge" missing="" /> <entity site="enwiki" title="Noreg" missing="" /> <entity site="enwiki" title="Norwegen" missing="" /> <entity pageid="127194" ns="0" title="Q5786" lastrevid="169682" modified="2012-11-26T15:47:43Z" id="q5786" type="item" /> </entities> </api> The original code doesn't seem to handle overflow entries very well, but the newer code does work. In the previous case it seems like misbehaving code tried to get undefined site ids and titles. Especially note the following case http://wikidata-test-repo.wikimedia.de/w/api.php?action=wbgetentities&props=info&sites=enwiki|nnwiki|nowiki&titles=Norway|Noreg|Norge Which will report a single found entity of type item <?xml version="1.0"?> <api success="1"> <entities> <entity pageid="127194" ns="0" title="Q5786" lastrevid="169684" modified="2012-11-26T15:55:10Z" id="q5786" type="item" /> </entities> </api>
As an additional note the previous will produce sitelinks in the latest version on wikidata-test-repo http://wikidata-test-repo.wikimedia.de/w/api.php?action=wbgetentities&props=sitelinks/urls|info&sites=enwiki|nnwiki|nowiki&titles=Norway|Noreg|Norge <?xml version="1.0"?> <api success="1"> <entities> <entity pageid="127194" ns="0" title="Q5786" lastrevid="169684" modified="2012-11-26T15:55:10Z" id="q5786" type="item"> <sitelinks> <sitelink site="enwiki" title="Norway" url="http://en.wikipedia.org/wiki/Norway" /> <sitelink site="nnwiki" title="Noreg" url="http://nn.wikipedia.org/wiki/Noreg" /> <sitelink site="nowiki" title="Norge" url="http://no.wikipedia.org/wiki/Norge" /> </sitelinks> </entity> </entities> </api>
Change I34abd62e: Minor cleanup to wbgetentities
Verified in Wikidata demo time for sprint 24