Help:Property constraints portal/Diff within range
This is the documentation page for a particular constraint type. See Help:Property constraints portal for a general overview of property constraints. |
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 .
WikibaseQualityConstraints normalizes the range endpoints before checking this constraint; for example, the intervals and 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
[edit]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
[edit]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 value (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 (). 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 (). unknown value Help is not permitted.
Example
[edit]Example setting for date of birth (P569).
property constraint |
| ||||||||||||||||
add value |
Template
[edit]When the constraint is set to the property, the following template is automatically displayed in the property talk page. The template is created by Module:Constraints using Template:Constraint, invoked from Template:Property documentation. Translations are defined at Module:i18n/constraints.
List of violations of this constraint: Database reports/Constraint violations/P570#Diff within range
Lists
[edit]Lists of properties which are set difference within range constraint.
- Category:Properties with difference within range constraints
- SPARQL query - click the execute button at the linked page to see the query result.