Page MenuHomePhabricator

[Task] Create extension mechanism for Wikibase Repository
Closed, ResolvedPublic

Description

In order to support new entity types in Wikibase Repository, extensions need to be able to register handlers for the entity types they add. There are dozens of types of such handlers that need to be registrable. (Not just for new entity types.)

At present most handler lists are set in the top level factory (WikibaseRepo), or are being refactored towards being set there.

Example: getEntityIdParser in WikibaseRepo provides an EntityIdParser to the rest of the code, avoiding the using code to bind to any specific parsers or global state. This method that constructs it can add support for new types of entity ids, though it needs to somehow get the information from the extensions.

Related Objects

StatusSubtypeAssignedTask
Declineddchen
OpenNone
OpenNone
DuplicateNone
OpenFeatureNone
OpenFeatureNone
DuplicateNone
ResolvedNone
ResolvedNone
ResolvedNone
DuplicateNone
InvalidLydia_Pintscher
OpenNone
OpenNone
StalledNone
OpenNone
ResolvedAddshore
Resolvedthiemowmde
ResolvedAddshore
Resolveddaniel
ResolvedBene

Event Timeline

JeroenDeDauw raised the priority of this task from to High.
JeroenDeDauw updated the task description. (Show Details)
JeroenDeDauw changed Security from none to None.
JeroenDeDauw added subscribers: Unknown Object (MLST), thiemowmde, hoo and 6 others.

We could just bolt the whole pile of extension points on top of the WikibaseRepo class. Then extensions to Wikibase Repository could do something like

$wikibaseRepo->registerEntityIdParser( $myNewEntityIdParser );

This will add a lot of state to WikibaseRepo, which already has quite some state (though all state with a different purpose). Adding a distinct service that is then used by WikibaseRepo is probably better. Looking into this more before actually making changes is advised, since changing it later will be difficult.

Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
JanZerebecki renamed this task from Create extension mechanism for Wikibase Repository to Create extension mechanism for Wikibase Repository for new entity types.Feb 27 2015, 11:08 AM
JeroenDeDauw renamed this task from Create extension mechanism for Wikibase Repository for new entity types to Create extension mechanism for Wikibase Repository.Feb 27 2015, 1:12 PM
JeroenDeDauw updated the task description. (Show Details)

One way to go about this is to add factory methods for all the relevant services to the EntityHandler sublcass for the respective entity type. Since MediaWiki already has a registry for ContentHandlers, and each entity type is bound to a content model, this should work fine. All that is needed at the root is a list of all relevant content models, this already exists, and can be modified via the WikibaseContentModelMapping hook.

However, any entity type specific code needed on the client cannot use this mechanism, since the EntityHandler is not (and should not be) present on the client. This is true in particular for the serializer and unserializer.

Bene renamed this task from Create extension mechanism for Wikibase Repository to [Task] Create extension mechanism for Wikibase Repository.Feb 5 2016, 1:10 PM
Bene subscribed.

Change 268667 had a related patch set uploaded (by Bene):
Use $wgContentHandlers to register custom handlers

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

Bene edited projects, added Wikidata-Sprint-2016-02-02; removed Patch-For-Review.
Bene added a project: Patch-For-Review.
Bene removed a subscriber: gerritbot.

@daniel: this task is not just about entity types. As for forcing such extensions to bind to content handler... this really does not seem nice dependency wise.

Change 268667 merged by jenkins-bot:
Use $wgContentHandlers to register custom handlers

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

Change 270643 had a related patch set uploaded (by Bene):
[DNM] Draft entity type registry

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

Change 270643 merged by jenkins-bot:
Create entity type registry

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

Change 271140 had a related patch set uploaded (by Bene):
Use EntityTypeDefinitions in repo and client

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

Change 271140 merged by jenkins-bot:
Use EntityTypeDefinitions in repo and client

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

Bene moved this task from Doing to Done on the Wikidata-Sprint-2016-03-01 board.