Page MenuHomePhabricator

[ES-M2]: Return EntitySchema as `wikibase-entityid` through the Action API
Open, Needs TriagePublic13 Estimated Story Points

Description

As a tool developer I want the Action API to replicate the same response to EntitySchemas in statements as other Wikibase Entities in order to have a more seamless experience

Problem:
From @Pintoch: As a tool developer, I observe that the API exposes those values as string data values and not entities: https://test.wikidata.org/w/api.php?action=wbgetentities&ids=Q497.

Screenshot 2023-06-20 at 14-18-51 MediaWiki API result - Wikidata.png (719×900 px, 87 KB)

In this screenshot, you can see that the Action API returns the type for the EntitySchema data-value in a statement as string rather than wikibase-entityid as it does for item values.

To maintain consistency with other Semantic Entities and a good UX we will use wikibase-entityid for the EntitySchema data value type.

BDD
GIVEN statement using the EntitySchema data type
AND Action API
WHEN Action API returns the statement
THEN the EntitySchema data-value is returned as wikibase-entityid

Acceptance criteria:

  • An EntitySchema data-value is returned as a wikibase-entityid data-value type when accessed through the Action API

Open questions
Could returning the EntitySchema value as entityschemaid be a solution?

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
Resolved karapayneWMDE
OpenNone
OpenNone
ResolvedNone
DeclinedNone
ResolvedNone
ResolvedNone
ResolvedNone
OpenNone
OpenNone
InvalidBUG REPORTLucas_Werkmeister_WMDE
OpenNone
OpenNone
OpenNone
ResolvedNone
OpenNone

Event Timeline

Arian_Bozorg renamed this task from [ES-M2]: Return EntitySchema as `wikibase-entity` through the Action API to [ES-M2]: Return EntitySchema as `wikibase-entityid` through the Action API.Jun 21 2023, 9:35 AM

After some product discussions, I am happy to go with entityschemaid and get this rolling

Arian_Bozorg renamed this task from [ES-M2]: Return EntitySchema as `wikibase-entityid` through the Action API to [ES-M2]: Return EntitySchema as `entityschemaid` through the Action API.Jul 11 2023, 12:34 PM
Arian_Bozorg updated the task description. (Show Details)

I fail to see how inventing a brand new data value type solves @Pintoch’s concern that it should use the same data value type as other entities.

I fail to see how inventing a brand new data value type solves @Pintoch’s concern that it should use the same data value type as other entities.

To me as well, it would make sense that wikibase-entityid would be more conductive to a seamless integration with existing tools.

To elaborate a bit more – I’m worried that creating a new data value type, instead of using either of the suitable existing data value types (string or wikibase-entityid), will actually create more work for tool developers. It’s much rarer for us to create new data value types than new data types – I think this 2015 snapshot of Special:ListDatatypes already contains all the data value types we have today (string, entity ID, globe coordinate, monolingual text, quantity, time). And I think the comments by @Pintoch and @Tpt in the on-wiki discussion support this as well.

Yes, if it was unclear from my comments I can try to clarify again here. From an API user perspective my preferences are (from most preferred to least preferred):

  1. wikibase-entityid datavalue type, for consistency with the targeted user experience (EntitySchemas being entities themselves)
  2. string datavalue type, which is inconsistent with the UX but has the benefit of being an established datavalue type, which any existing API client library is bound to support already (Wikidata-Toolkit, Wikibase-SDK, pywikibot, …)
  3. A new datavalue type, which will likely require some light changes in most API client libraries, and perhaps lead to failures of various severities until those changes are made (for those which have not anticipated the introduction of new datavalue types)

Based on the discussions that we have had over the last weeks, and the request for a product decision to be made; the best option from our side would be wikibase-entityid as it would maintain consistency with other Semantic Entities, ensure a good UX and allow tools to be easily utilised for EntitySchemas.

The other options considered were :

  • string which would present a poor UX and would not require us to make any changes, but could pose issues if this is changed further down the line
  • entityschemaid which would require tool builders to adapt their tools to a new data value type

I will update the ticket accordingly, thank you all so much for your help and patience on this.

Arian_Bozorg renamed this task from [ES-M2]: Return EntitySchema as `entityschemaid` through the Action API to [ES-M2]: Return EntitySchema as `wikibase-entityid` through the Action API.Aug 8 2023, 12:40 PM
Arian_Bozorg updated the task description. (Show Details)

Personally I will oppose wikibase-entityid since EntitySchema is not a type of Wikibase entity. EntitySchema is a completely independent extension.

(striken 2023-08-29; see T344609#9124706)
(reinstated 2023-10-18; see T344609#9260423)

Personally I will oppose wikibase-entityid since EntitySchema is not a type of Wikibase entity. EntitySchema is a completely independent extension.

That is a technical implementation detail which is in principle independent of the question of the product requirement of what API should be available to the users. This task here is purely about the product requirement.
That being said, making EntitySchema a proper Wikibase Entity is certainly one sensible way of doing this, though not exactly trivial either.

WMDE-leszek set the point value for this task to 13.Aug 22 2023, 9:03 AM
WMDE-leszek moved this task from Unified DOT Backlog to Sprint-∞ on the Wikidata Dev Team board.

Task Breakdown notes:

  • This can be done in a relatively similar way to how senses and forms are registered in Lexeme.
  • Nothing seems to obviously break, but this is just from a quick glance at the code, it seems like we might not need to rely on any new services in Wikibase.
  • We can start by changing the data type in the DT registration and start trying to fix any faulty or broken classes.
  • We don't really see any immediate opportunities to parallelize work on this, however, if anything emerges we might create new sub-tasks as we go along.

Change 953672 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/EntitySchema@master] Make EntitySchemaId implement EntityId

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

Change 953687 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/EntitySchema@master] Support EntityIdValue in EntitySchemaFormatter

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

As a reminder: Changing the meaning of wikibase-entityid value type to include non-Wikibase entities is a breaking change and should be announced per https://www.wikidata.org/wiki/Wikidata:Stable_Interface_Policy (adding a new type of Wikibase entity is not breaking, but adding a non-Wikibase entity is); Adding a new value type is only significant change, not breaking.

As the EntitySchemas project is in a short hiatus, I am removing the relevant tickets from the board