Last modified: 2014-08-19 10:14:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T47509, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 45509 - wbgetentities API returns useless (at least useless in XML) "missing" attribute for missing entities
wbgetentities API returns useless (at least useless in XML) "missing" attribu...
Status: VERIFIED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Wikidata bugs
: easy
Depends on:
Blocks: repoapi
  Show dependency treegraph
 
Reported: 2013-02-27 18:47 UTC by Daniel A. R. Werner
Modified: 2014-08-19 10:14 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel A. R. Werner 2013-02-27 18:47:17 UTC
When requesting entities via wbgetentities API module, requested entities which are not in the system will still be taken into the result set with a "missing" attribute. In xml this will look like:

<entities><entity missing="" /></entities>

in JSON:

"entities": { "p1311": { "missing": "" } }

So in the JSON version you can actually still see which entity is missing, in XML you can't.

I would simply suggest taking those references to missing entities entirely out of the result set since the requester can simply check whether all requested entities are actually in the result.
Those "special" entries just make it necessary to differentiate between "real" entity data and other information which requires more additional code.
Comment 1 Kunal Mehta (Legoktm) 2013-08-31 23:09:36 UTC
I think a better solution here would be to simply add the id into the missing="" tag. Compare the wbgetentities output with the standard API one:


https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q12324283476384&format=xmlfm

<api success="1">
  <entities>
    <entity missing="" />
  </entities>
</api>

https://en.wikipedia.org/w/api.php?action=query&prop=info&titles=Asljdhfksdjhfksdjfh

<api>
  <query>
    <pages>
      <page ns="0" title="Asljdhfksdjhfksdjfh" missing="" contentmodel="wikitext" pagelanguage="en" />
    </pages>
  </query>
</api>
Comment 2 Daniel Kinzler 2014-07-31 11:39:40 UTC
The "missing" tag should always be there, along with any other details we may have (that is, usually, either site and title or the id). The key for the missing entry may or may not be a negative number - in case a lookup by ID failed, the key should be the requested id, for convenient lookup.
Comment 3 Gerrit Notification Bot 2014-07-31 11:47:46 UTC
Change 150790 had a related patch set uploaded by Daniel Kinzler:
Allow explicit keys for entities in API results.

https://gerrit.wikimedia.org/r/150790
Comment 4 Daniel Kinzler 2014-07-31 12:15:00 UTC
The patch linked above isn't sufficient to fix this, but together with Ic5c4d211df, that should do it. To verify, request a non-existing item by id and ask for xml output. It should then contain <entity id="Q1245" missing="" />.
Comment 5 Gerrit Notification Bot 2014-08-01 11:55:05 UTC
Change 150790 merged by jenkins-bot:
Allow explicit keys for entities in API results.

https://gerrit.wikimedia.org/r/150790

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links