Page MenuHomePhabricator

Add “language required by this lexeme” constraint type
Closed, ResolvedPublic13 Estimated Story Points

Description

As a data model maintainer, I want to check that some Properties are only used on Lexemes with certain languages, in order to ensure that they are used correctly.

Problem:
@Esc3300 created a constraint Item language required by this Lexeme. Presumably, we should support it.

Example:
The constraint type is used on the property Japanese pitch accent type, with the language Japanese.

Screenshots/mockups:
Message drafts:

For the case where there is only one allowed language defined on the Property:

The Property Japanese pitch accent type should only be used on Lexemes in Japanese.

For the case where there are multiple allowed languages defined on the Property:

This Property should only be used on Lexemes in one of the following languages:

BDD
GIVEN I am visiting a lexeme using a property with a “language required by this lexeme” constraint on either the Lexeme-level statements or on its Forms or Senses
AND the lexeme does not have the required language
THEN there is a “constraint violation” icon on the statement(s) with that property
AND the violation message explains the problem, including listing the allowed language(s)

Acceptance criteria:

  • the constraint type is implemented
  • after editing the language and reloading the page, the violation is no longer shown
  • for now it is not necessary to remove the constraint violation indicator without reloading the page
  • Check nothing breaks if the Lexeme extension isn't enabled in the wikibase instance

Open questions:

  • If more than one language item is specified in the constraint parameters, this means “one of these languages”, correct? @Esc3300 @Ivan_A_Krestinin -> Yes!

Event Timeline

Things that might be useful:

Change 696508 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/WikibaseQualityConstraints@master] [WIP] Introduce Lexeme Language constraint

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

Change 697033 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[integration/config@master] Add WikibaseLexeme to dependencies of WikibaseQualityConstraints

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

Change 697033 merged by jenkins-bot:

[integration/config@master] Add WikibaseLexeme to dependencies of WikibaseQualityConstraints

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

Change 697601 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/WikibaseQualityConstraints@master] Add support for Sense and Form in LanguageChecker

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

Change 696508 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/WikibaseQualityConstraints@master] [WIP] Introduce Lexeme Language constraint

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

As implemented in this change, the constraint is enabled by default in all context types: main snak, qualifier, references. I think this could be sensible (does it make sense to use, say, a Duden ID in a reference on an English lexeme?), but I figured I’d mention it here in case someone (especially Lydia) thinks otherwise.

Also, currently somevalue and novalue in the parameters are ignored when checking, but potentially included in the violation message (“Statements for Duden ID should be only on Lexemes with language set to either German or unknown value.”) – maybe we should report those as errors in the constraint definition?

Change 696508 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Introduce Lexeme Language constraint

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

As implemented in this change, the constraint is enabled by default in all context types: main snak, qualifier, references. I think this could be sensible (does it make sense to use, say, a Duden ID in a reference on an English lexeme?), but I figured I’d mention it here in case someone (especially Lydia) thinks otherwise.

It could make sense to use a Duden ID in a reference on an English lexeme if, for example, the German word comes from English and the Duden gives more details about the etymology, e.g. https://www.duden.de/rechtschreibung/Skateboard or https://www.duden.de/rechtschreibung/Team

Are the other constraints available in all context types by default? If so, I think it would still make sense to do the same here.

Are the other constraints available in all context types by default? If so, I think it would still make sense to do the same here.

The default can be configured per constraint type, but it looks like most constraint types are checked on all context types by default, unless they don’t support all context types (e.g. “allowed qualifiers” or “symmetric”). The two exception so far seem to be “type” and “unique value” / “distinct values”, which I think support all context types, but are only checked on the main snak by default.

Change 697601 merged by jenkins-bot:

[mediawiki/extensions/WikibaseQualityConstraints@master] Add support for Sense and Form in LanguageChecker

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