Page MenuHomePhabricator

Import mandatory qualifiers constraints from statements
Closed, ResolvedPublic

Event Timeline

Hm, there is one problem: in constraint statements, you should only specify a single property in one “mandatory qualifier” constraint (source), while in templates it’s allowed to specify multiple properties. Only 16 constraints on Wikidata actually do that, so in my opinion it’s okay to drop support for this even while we still support constraint templates for a short time (we’ll just quietly ignore the extra properties in a template instead of raising an exception), but this means that the current message is no longer appropriate.

Here’s the current message for “mandatory qualifiers”:

This $1 statement is missing {{PLURAL:$2|1=a qualifier $4.|2=$4 and $5 qualifiers.|the following qualifiers:$3}}

with the following explanation:

Message for a violation of the “Mandatory qualifiers” constraint, when one or more mandatory qualifiers are missing on a statement. Parameters:

  • $1 is the property of the statement.
  • $2 is the number of missing qualifiers.
  • $3 is an HTML list of all missing qualifiers.
  • $4, $5 etc. are the individual missing qualifiers.

I see three options:

  1. Keep the message exactly as it is, and always supply $2 = 1, $3 = one-element list, $4 = the single required qualifier.
  2. Change the message to “This $1 statement is missing a qualifier $4.”, and document $2 and $3 as dummy/placeholder parameters. For compatibility with old messages, still supply $2 = 1 and $3 = one-element list.
  3. Change the message to “This $1 statement is missing a qualifier $2.”

I’m not sure what the best option is… perhaps @Amire80 or @abian can comment?

Only 16 constraints on Wikidata actually do that, so in my opinion it’s okay to drop support for this even while we still support constraint templates for a short time (we’ll just quietly ignore the extra properties in a template instead of raising an exception),

+1. In fact, if statements are better supported than templates, the community will definitely stop using these templates, and that's a good thing. 😃

I see three options:

  1. Keep the message exactly as it is, and always supply $2 = 1, $3 = one-element list, $4 = the single required qualifier.
  2. Change the message to “This $1 statement is missing a qualifier $4.”, and document $2 and $3 as dummy/placeholder parameters. For compatibility with old messages, still supply $2 = 1 and $3 = one-element list.
  3. Change the message to “This $1 statement is missing a qualifier $2.”

I’m not sure what the best option is… perhaps @Amire80 or @abian can comment?

I like the 3 because it leaves the simplest code and documentation. I see no reason to preserve compatibility with the current message.

What will happen with the translations until they are updated? Does TranslateWiki throw them away automatically because the message changed too much? I don’t want to show broken messages to users because we’re passing the wrong parameters to old translations…

EDIT: According to Localisation#Changing existing messages, the message key should be changed in this case.

These changes could be introduced by creating a new message (with a new name) and deleting the current one. The current message is named "wbqc-violation-message-mandatory-qualifiers" (plural), so the new one could be "wbqc-violation-message-mandatory-qualifier" (singular).

(Edit conflict) 😉

@abian thanks, that’s a great idea! I was afraid of an ugly …-qualifiers-2 message key, but your suggestion is much nicer :)

Change 358321 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Import Mandatory qualifier constraints from statements

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

Change 358321 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Import Mandatory qualifier constraints from statements

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