Page MenuHomePhabricator

Add support for “separators” parameter of “single value” and “single best value” constraint types
Closed, ResolvedPublic8 Estimated Story Points

Description

Some properties are supposed to only hold unique values in statements. This can be modeled via a unique value constraint. There are a lot of these values that only have to be unique with a given qualifier. As an editor I want to be able to define which qualifiers are acceptable to keep the uniqueness of values for a given property so I can model reality more completely without causing constraint violations.

Existing modeling example: https://www.wikidata.org/wiki/Property:P856

Examples where this is likely to be used:

  • heads of government over time
  • official websites by country

Questions that came up:

  • What happens if one value has a qualifier for the separating property and one doesn’t? -> It is not considered a violation.
  • Are two unknown values for the separating property considered different? -> Yes.
  • What happens if values have multiple qualifiers for the separating properties? -> We are lenient and accept the values as long as the sets of qualifiers are different, even if they partially overlap.

Event Timeline

parameter for single value constraint. Multiple values are allowed under the single value constraint if they have different values for this property

Maybe it should read "this qualifier" instead of "this property" (meant is the value of the qualifier P4155: a property that is being used as qualifier). The value of the the statement that is being qualified shouldn't have an impact (it can be a string/URL/external id) depending on the property's datatype. Sample: there is a single-value constraint on "official website". Multiple values are possible if a qualifier states the language of the website.

@Ivan_A_Krestinin would have full details about its current workings.

Should this also extend to the “multi value” constraint (e. g. must have multiple values with different values for the separating property)?

IMHO, the separator could make it possible that a property has both constraints: single-value and multiple-value ;)

In the interest of moving this task forward, I’ll try to make up some reasonable answers to the questions asked in the task description:


What happens if one value has a statement qualifier for the separating property and one doesn’t?

Acceptable. I can imagine, for example, one main “official website” (preferred rank, supports multiple languages) and then another language- or region-specific one (with qualifier).

Are two unknown values for the separating property considered different?

Considered different, following the semantics of our RDF export (where unknown value maps to different, unique blank nodes, which are all different from each other).

What happens if values have multiple qualifiers for the separating properties?

Be lenient and accept the values as long as the sets of qualifiers are different, even if they partially overlap.

Should this also extend to the “multi value” constraint (e. g. must have multiple values with different values qualifiers for the separating property)?

No such constraint currently defined on Wikidata, so let’s not bother with that for now.


Does anyone disagree with any of those answers? :)

Does anyone disagree with any of those answers? :)

I'm ok with them.

https://www.wikidata.org/wiki/Property:P36 might be a good sample for the different separators.

Thanks, P​36 will be very helpful when working on this.

I’d say it should probably be a separate, more detailed message.

Lucas_Werkmeister_WMDE renamed this task from Add support for “separators” parameter of “single value” constraint type to Add support for “separators” parameter of “single value” and “single best value” constraint types.Apr 20 2018, 1:01 PM

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