Help:Property constraints portal/Diff within range

Other languages:
Deutsch • ‎English • ‎français • ‎polski • ‎русский • ‎српски / srpski • ‎العربية

difference within range constraint (Q21510854) specifies that the difference between the values for two properties should be within a certain range or interval. This constraint is available for quantity or date properties.

For example, the difference between date of birth (P569) and date of death (P570) should be positive, but no more than 150 years: it should be within the interval ${\displaystyle [0\,\mathrm {a} ,150\,\mathrm {a} ]}$.

WikibaseQualityConstraints normalizes the range endpoints before checking this constraint; for example, the intervals ${\displaystyle [0~\mathrm {days} ,14~\mathrm {days} ]}$ and ${\displaystyle [0~\mathrm {weeks} ,2~\mathrm {weeks} ]}$ are equivalent.

If no constraint scope (P4680) is specified, this constraint is only checked on the main value of a statement. This is also the only currently supported scope.

Possible actions

There are several possible ways to address a violation of this constraint:

• It’s possible that the value in the statement with the constraint is incorrect and should be fixed.
• It’s possible that the value in the other statement is incorrect and should be fixed.
• It’s possible that one of the two statements should be removed completely.
• It’s possible that the item is a rare, but legitimate exception to the constraint, and nothing should be done.

Parameters

This constraint has three mandatory parameters:

property (P2306)
Contains the related property. Must contain exactly one property (no value Help or unknown value Help is not permitted), which must have the same data type as the property on which the constraint is placed. The difference is calculated as the value for the property with the constraint minus the value for the property given in this parameter, so usually the constraint is placed on the “upper” property (e. g. date of death (P570)), and the parameter specifies the “lower” property (e. g. date of birth (P569)).
minimum quantity (property constraint) (P2313)
The lower boundary of the permitted range. The unit of the boundary value should match the unit of the two properties (e. g. year (Q577) for date of birth (P569) and date of death (P570)). no value Help can be used to specify a range with no lower boundary (${\displaystyle (-\infty ,n]}$). unknown value Help is not permitted.
maximum value (P2312)
The upper boundary of the permitted range. The unit of the boundary value should match the unit of the two properties (e. g. year (Q577) for date of birth (P569) and date of death (P570)). no value Help can be used to specify a range with no upper boundary (${\displaystyle [n,+\infty )}$). unknown value Help is not permitted.

Example

Example setting for date of birth (P569).

property constraint
difference within range constraint edit
 maximum value 150 year
▼ 0 reference