Page MenuHomePhabricator

Add option to only consider best-rank statements when checking “single value” constraint
Closed, ResolvedPublic

Description

Currently “single value” counts non-deprecated statements. However, there are many properties where it makes more sense to require one best-rank statement, but allow several other non-deprecated statements as long as the best one is marked with preferred rank (for example “ethnic group”, “official website”, various website usernames, or “head of government”). There should be an optional constraint parameter to select this interpretation instead of the default one.

This is required for T173695: Enable constraint checks by default for users, because currently there are many “single value” constraints that make more sense with this relaxed interpretation, so users would see too many invalid constraint violations.

For now, I would suggest the constraint parameter (property) name “counting mode”, with values “non-deprecated statements” (default) and “best-rank statements”. But that’s up for discussion :)


Patch-For-Review:

Details

Related Gerrit Patches:
mediawiki/extensions/WikibaseQualityConstraints : masterAdd “single best value” constraint type
mediawiki/extensions/WikibaseQualityConstraints : masterAdd $groupingMode to Context::getSnakGroup()

Event Timeline

Lucas_Werkmeister_WMDE triaged this task as Medium priority.Dec 19 2017, 4:18 PM
Lucas_Werkmeister_WMDE created this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 19 2017, 4:18 PM

Before making this configurable, we should first investigate whether there are any “single value” constraints where the current interpretation (non-deprecated statements) is really necessary, or whether “best-rank statements” should be used everywhere.

I think there are enough properties where the current interpretation (disallow multiple non-deprecated statements even if only one of them has best rank) is the preferable one: for example fictional analog of, retrieved, version type, list of episodes, domain, codomain, blood type, face value, and most external identifiers.

For now, I would suggest the constraint parameter (property) name “counting mode”, with values “non-deprecated statements” (default) and “best-rank statements”. But that’s up for discussion :)

Hm, alternative suggestion: new constraint type “single best value”. WDYT?

In the meantime, I’ll start preparing for this, because the internal challenges of implementing such a counting mode are independent of how it’s modeled as a constraint statement. (As far as I can tell, this pretty much kills the current getSnakGroup abstraction, since now the composition of the “snak group” varies…)

Change 427675 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Add $groupingMode to Context::getSnakGroup()

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

Let’s go with the “new constraint type” implementation for now, WikiProject seems to be slightly in favor of it and I also prefer it.

Jonas updated the task description. (Show Details)
Jonas moved this task from Needs Review to In Progress on the Wikidata-Ministry-Of-Magic board.

Change 427675 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Add $groupingMode to Context::getSnakGroup()

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

Change 427901 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Add “single best value” constraint type

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

Change 427901 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Add “single best value” constraint type

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

Is there an example already somewhere?

I imported some data from Wikidata to wikidata-constraints where you can try it out:

(Yes, I just left the same comment on T173594 – not a copy+paste accident: we can just test the similar constraint on the same items ☺)

Lydia_Pintscher closed this task as Resolved.May 16 2018, 9:35 AM