Lucas_Werkmeister_WMDE added a comment.

  Well, I would say it’s not really a bug, more an unfortunate combination of 
features. There are currently two ways to get an entity ID out of MWAPI:
  
  Given a “client-like” API result like this
  
    <page _idx="32882493" pageid="32882493" ns="0" title="Mary E. Cobb" 
contentmodel="wikitext" pagelanguage="en" pagelanguagehtmlcode="en" 
pagelanguagedir="ltr" touched="2021-06-28T08:26:03Z" lastrevid="1030833675" 
length="7412">
      <pageprops defaultsort="Cobb, Mary E." page_image_free="Mary_E._Cobb.jpg" 
wikibase_item="Q6779361" />
    </page>
  
  then the MWAPI config
  
    ?item wikibase:apiOutputItem mwapi:item.
  
  corresponds to the XPath `pageprops/@wikibase_item`, i.e. the `wikibase_item` 
attribute of the `pageprops` child element of that `page` element.
  
  Given a “repo-like” API result like this
  
    <page _idx="102358522" pageid="102358522" ns="0" title="Q107110037" 
contentmodel="wikibase-item" pagelanguage="en" pagelanguagehtmlcode="en" 
pagelanguagedir="ltr" touched="2021-06-08T03:16:28Z" lastrevid="1437430459" 
length="1963">
      <pageprops wb-claims="3" wb-identifiers="0" wb-sitelinks="1" />
    </page>
  
  then the MWAPI config
  
    ?item wikibase:apiOutputItem mwapi:title.
  
  corresponds to the XPath `@title`, i.e. the `title` attribute of that `page` 
element.
  
  In both cases, the assumption is that the XPath selects the entity ID as a 
string, but for the `title` attribute, that’s only true for items, not other 
entity types. (On Wikibase installations where items aren’t in the main 
namespace, I assume it’s not even true for items.) But I’m not sure what the 
best way to solve this would be – I would be hesitant to hard-code something 
like “remove everything up to the first colon” into MWAPI.
  
  Maybe we can add a new value for the `query+prop` API parameter, which would 
add the page’s entity ID (as an attribute on the `page` element, like the 
`contentmodel`, `pagelanguage`, etc.)? And then we could add that by default to 
the MWAPI “Generator” service, and add a new shortcut, `mwapi:entityid` = 
`@wikibase_entity` or something like that.

TASK DETAIL
  https://phabricator.wikimedia.org/T285606

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Lydia_Pintscher, Lucas_Werkmeister_WMDE, Aklapper, Ainali, Invadibot, 
MPhamWMF, maantietaja, CBogen, Akuckartz, Nandana, Namenlos314, Lahi, Gq86, 
GoranSMilovanovic, QZanden, EBjune, merbst, LawExplorer, _jensen, rosalieper, 
Scott_WUaS, Jonas, Xmlizer, jkroll, Wikidata-bugs, Jdouglas, aude, Tobias1984, 
Manybubbles, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org

Reply via email to