Page MenuHomePhabricator

[Story] New datatype for referencing Lexemes
Closed, ResolvedPublic

Description

We want to make statements on Lexemes that reference other Lexemes.

Example usage: on the Lexeme "hard" we'd have a statement "derived from: heard". "heard" would be another Lexeme.

Event Timeline

Change 357571 had a related patch set uploaded (by Ladsgroup; owner: Amir Sarabadani):
[mediawiki/extensions/WikibaseLexeme@master] [WIP] Start of a basic and broken WikibaseLexeme.datatypes.php

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

Change 357794 had a related patch set uploaded (by Ladsgroup; owner: Amir Sarabadani):
[mediawiki/extensions/Wikibase@master] Make ValidatorBuilders::getEntityValidators public

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

Change 357796 had a related patch set uploaded (by Ladsgroup; owner: Amir Sarabadani):
[mediawiki/extensions/Wikibase@master] [Code experiment] What needs to be done to make lexeme datatype work

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

Okay, I was able to add lexeme as value after tons of horrible hacks which I explain below. First, take a look:

image.png (631×1 px, 45 KB)

I was able to add using both API and GUI.

Now let's talk about hacks:

Once these are in place, https://gerrit.wikimedia.org/r/357571 would work just fine.

If https://gerrit.wikimedia.org/r/357571 gets merged without merging anything else, users will be able to make properties that have "lexeme" as data type and that alone is a huge win.

Okay, I was able to add lexeme as value after tons of horrible hacks which I explain below. First, take a look:

It's beautiful! :D

Overall does not seem that horrible, thanks @Ladsgroup

LegacyIdInterpreter is hardcoded to Property and Item. This needs to be changed (I added lexeme to that file in my localhost)

I believe the way out here is to stop using this class and used EntityIdComposer instead. How exactly do all this, it is another story.

Lots of frontend hacks had to be pushed to Wikibase, I don't know how to make frontend code injectable.

the patch itself seems small but I expect that making those few places in the frontend code generic, or making it possible to use something Lexeme-specific in the UI in a way it all fits together will be loads of work or fun.

Change 357794 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Make ValidatorBuilders::getEntityValidators public

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

Change 357571 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Start of a basic WikibaseLexeme.datatypes.php

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

I'm signing off this since I don't know how to handle to frontend part, I will try to tackle the backend part though.

Change 357796 abandoned by Ladsgroup:
[Code experiment] What needs to be done to make lexeme datatype work

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