Page MenuHomePhabricator

Merge Lexemes via a Special Page
Closed, ResolvedPublic13 Estimated Story Points

Description

As an editor I want to be able to merge two Lexemes in order to eliminate duplicates.

Screenshots:

Before merge of two items:

Screenshot_20180625_161000.png (1,549×710 px, 44 KB)

After successful merge of two items:

Screenshot_20180625_160707.png (1,500×752 px, 62 KB)

BDD

GIVEN I have two Lexemes that I consider to represent the same word
WHEN  I go to Special:MergeLexemes
AND   enter their IDs
AND   I click "merge Lexemes"
THEN  the source Lexeme is emptied and replaced by a redirect to the target Lexeme
AND   the lemmas are merged
      - lemmas that exist both on the target and the source are kept on the target
      - lemmas that exist only on the source are added to the target
AND   the statements are merged
      - statements that exist both on the target and the source are kept on the target
      - statements that exist only on the source are added to the target
      - statements are merged when their main snak is identical (resulting in one statement with the qualifiers and references from both statements)
AND   the forms are merged
      - if there exists a form on the source that is identical to a form on the target (i.e. they have identical grammatical features, at least one common representation and no different representations for the same spelling variant)
        - their representations are merged in the same way lemmas are merged
        - their statements are merged in the same way they're merged on the lexeme level
      - forms that only exist on the source are added to the target
AND   I get a confirmation message saying "L123 was merged into L1234 and redirected."

Acceptance criteria:

  • A new SpecialPage Special:MergeLexemes exists and can be used to merge two Lexemes.
  • After a merge the source Lexeme contains a MediaWiki redirect to the target Lexeme (just like it is done for items).
  • After the merge I can go to the URL of the source Lexeme and am redirected to the target Lexeme.
  • If there are identical Forms (same representation and grammatical features) in each Lexeme then the statements for that Form get added to the existing Form.

Notes:

  • Blocking of specific bad merges is not covered in this ticket.
  • Redirecting on the Form level is not to be done at this point - only the Lexeme level
  • Text and design on Special:MergeLexemes should be the same as on Special:MergeItems with s/Items/Lexemes. The text for the longer message should be "If you merge two Lexemes, all Lemmas, Statements, Forms and Senses will be moved from one Lexeme to the other."
  • Item pages after merge show a dedicated view (do not try to show the emptied item); let's ensure this happens for lexeme likewise

Related Objects

Event Timeline

Lydia_Pintscher triaged this task as Medium priority.
• Vvjjkkii renamed this task from Merge Lexemes via a Special Page to ecaaaaaaaa.Jul 1 2018, 1:02 AM
• Vvjjkkii raised the priority of this task from Medium to High.
• Vvjjkkii updated the task description. (Show Details)
• Vvjjkkii removed the point value 13 for this task.
CommunityTechBot renamed this task from ecaaaaaaaa to Merge Lexemes via a Special Page.Jul 2 2018, 10:07 AM
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot set the point value for this task to 13.
CommunityTechBot updated the task description. (Show Details)

I tried the integration of all our changes. It seems to work, supports the expected error handling, and makes sense overall.
One thing I found a bit irritating on the "success page" is that the lexeme ids that were just successfully merged (and mentioned in the success message) are pre-filled into the form fields again - which, of course, leads to an error (the source can not be found) when clicking "Merge Lexemes" another time.
An open question to me are the change summaries; see merge of L11 into L12 as compared to Q153 into Q154.

Bildschirmfoto von 2018-08-27 18-00-50.png (1,118×773 px, 171 KB)

Bildschirmfoto von 2018-08-27 18-00-55.png (1,118×773 px, 168 KB)

Bildschirmfoto von 2018-08-27 18-03-48.png (1,118×773 px, 176 KB)

Bildschirmfoto von 2018-08-27 18-03-59.png (1,118×773 px, 169 KB)

Added a possible solution at https://gerrit.wikimedia.org/r/455589

UX-wise an item selector to pick the lexemes, and a help text explaining what the merging rules and preconditions are would be great.

Change 455589 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] i18n: add messages for merge summaries

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

Change 456113 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] SpecialMergeLexemes: list special page

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

Wohoooooooooo!
This seems to work nicely. One minor thing: There still seems to be an issue with the edit summary. Example at https://wikidata.beta.wmflabs.org/w/index.php?title=Lexeme:L1&diff=1054016&oldid=1054015 and in the screenshot below.

Screenshot_20180830_114942.png (763×209 px, 37 KB)

@Lydia_Pintscher You found the control bug, congratulations (kidding). A single patch was not merged yet, is now. Please re-check (from 15:1515:30 to allow for deployment).

Change 455589 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] i18n: add messages for merge summaries

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

Change 456593 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Handle non-MergingExceptions thrown in LexemeMerger

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

Change 456593 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Handle non-MergingExceptions thrown in LexemeMerger

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

@Lydia_Pintscher You found the control bug, congratulations (kidding). A single patch was not merged yet, is now. Please re-check (from 15:1515:30 to allow for deployment).

:D

Change 456113 abandoned by Ladsgroup:
[DNM] SpecialMergeLexemes: list special page

Reason:
Suppressed by If06ee1

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

Change 456113 restored by Ladsgroup:
[DNM] SpecialMergeLexemes: list special page

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

Change 456113 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] SpecialMergeLexemes: list special page

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