Page MenuHomePhabricator

Showing the Lemma(s) or Representation(s) when Lexemes or Forms are mentioned in constraint reports
Closed, ResolvedPublic5 Story Points

Description

As an editor I want to easily understand what a constraint violation that involves a Lexeme or Form is saying in order to be able to fix the constraint violation.

Problem:
When a lexeme or form is mentioned in the violation message of a constraint report, the link text is only the entity ID, instead of the lemma(s) or representation(s).

Example:
https://www.wikidata.org/w/index.php?title=Lexeme:L123&oldid=704111533#P123

Screenshots:

BDD
GIVEN a statement has a constraint violation
AND the constraint violation explanation contains a reference to a Lexeme
THEN the link to that Lexeme should show the Lemma(s) as link text

GIVEN a statement has a constraint violation
AND the constraint violation explanation contains a reference to a Form
THEN the link to that Form should show the Representation(s) as link text

Acceptance criteria:

  • The Lexeme ID is no longer shown but instead the Lemma(s)
  • The Form ID is no longer shown but instead the Representation(s)

Technical notes:

WikibaseQualityConstraints initializes entity ID rendering like this:

$languageFallbackLabelDescriptionLookupFactory = $repo->getLanguageFallbackLabelDescriptionLookupFactory();
$labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup( $language );
$entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory();
$entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup );

It looks like the EntityIdHtmlLinkFormatter doesn’t support entities without labels correctly…?

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 22 2018, 4:59 PM

Hm, as far as I can tell Wikibase doesn’t really support this yet. WikibaseLexeme registers a formatter for lexeme ID values, but I can’t see any similar provision for direct entity ID formatters – EntityIdHtmlLinkFormatter (and, more directly, EntityIdLabelFormatter) assume that an entity has a label that can be taken from a LabelDescriptionLookup, and otherwise show the plain entity ID.

We probably need something like the DispatchingValueFormatter for the EntityIdFormatter interface.

Or I suppose we could get the same thing for cheap by creating an EntityIdFormatter that just wraps a DispatchingValueFormatter… not sure how that works with different output formats, though.

Is this a duplicate of T191600 ?

Definitely related, I guess, but it’s possible WikibaseQualityConstraints will need some changes after that task is merged…

Lydia_Pintscher triaged this task as Normal priority.May 27 2018, 4:10 PM
Lydia_Pintscher updated the task description. (Show Details)
Vvjjkkii renamed this task from Lexemes mentioned in constraint reports only show entity ID to whcaaaaaaa.Jul 1 2018, 1:08 AM
Vvjjkkii raised the priority of this task from Normal to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from whcaaaaaaa to Lexemes mentioned in constraint reports only show entity ID.Jul 2 2018, 4:41 AM
CommunityTechBot lowered the priority of this task from High to Normal.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.

@Lucas_Werkmeister_WMDE could you have a look at the open question please?

Lydia_Pintscher renamed this task from Lexemes mentioned in constraint reports only show entity ID to Showing the Lemma(s) when Lexemes are mentioned in constraint reports.Jul 8 2018, 3:55 PM

Are there places where this is also happening for Forms?

Yes, though due to T195828: Check constraints on Forms and Senses when loading Lexeme entity page you can’t see it directly on the entity page, you have to use the special page or directly call the API.

Lucas_Werkmeister_WMDE renamed this task from Showing the Lemma(s) when Lexemes are mentioned in constraint reports to Showing the Lemma(s) or Representation(s) when Lexemes or Forms are mentioned in constraint reports.Jul 9 2018, 10:34 AM
Lucas_Werkmeister_WMDE updated the task description. (Show Details)
Jakob_WMDE set the point value for this task to 5.Jul 10 2018, 12:50 PM

@Lucas_Werkmeister_WMDE It appears that the lexeme level link formatting is fixed. Can you confirm this, please?
We don't however get to see the form id shown in the latest screenshot - where is the place to go to reproduce this?
Thanks

Change 456368 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/Wikibase@master] Create DispatchingHtmlLinkFormatter

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

Change 457102 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/WikibaseQualityConstraints@master] Use EntityLinkFormatter not EntityIdHtmlLinkFormatters

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

Tarrow removed Tarrow as the assignee of this task.Sep 2 2018, 9:35 PM
Tarrow added a subscriber: Tarrow.

Change 456353 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/Wikibase@master] Rename EntityIdHtmlLinkFormatter to DefaultEntityIdHtmlLinkFormatter

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

Change 457509 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] FormsViewTest: use mock entity id formatter

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

Change 457509 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] ViewTests: use mock entity id formatter

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

Change 456353 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Rename EntityIdHtmlLinkFormatter to DefaultEntityIdHtmlLinkFormatter

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

Change 457924 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/Wikibase@master] Create LabelsProviderEntityIdHtmlLinkFormatter

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

Change 456368 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Create and use DispatchingEntityIdHtmlLinkFormatter

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

Change 456611 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/WikibaseLexeme@master] Wire Lexeme- and FormIdHtmlFormatters to EntityIdHtmlLinkFormatterFactory

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

Change 456611 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Wire Lexeme- and FormIdHtmlFormatters to EntityIdHtmlLinkFormatterFactory

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

Change 457102 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Use correct EntityIdFormatter per entity type

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

Change 459760 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] LexemeDiffVisualizerIntegrationTest: use Wikibase methods

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

Change 459770 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseQualityExternalValidation@master] EntityIdFormatterFactory: provide language

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

Change 459760 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] LexemeDiffVisualizerIntegrationTest: use Wikibase methods

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

Change 459770 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityExternalValidation@master] EntityIdFormatterFactory: provide language

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

Addshore moved this task from incoming to in progress on the Wikidata board.Sep 17 2018, 8:18 AM

Change 457924 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Create LabelsProviderEntityIdHtmlLinkFormatter

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

I tried to test this but can't seem to find a test system that has both constraints and Lexemes. @Lucas_Werkmeister_WMDE: Is there one?

I’m not aware of one, but we could probably set up WikibaseLexeme on the wikidata-constraints system. @Jonas do you want to try? :)