Help:Property constraints portal/Range

From Wikidata
Jump to navigation Jump to search

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

range constraint (Q21510860) specifies that values for a property should be within a certain range or interval. This constraint is available for quantity or date properties.

For example, flattening (P1102) is always between 0 or 1 (within the interval ), and time of spacecraft launch (P619) should not be before .

WikibaseQualityConstraints normalizes all quantities (applies unit conversion) before checking this constraint. For example, a mass of 500 g will be considered to lie within the range of , although 500 is not within the range , because the range endpoints are converted to ; on the other hand, a duration of 100 days will be considered to lie outside the range of (note the missing units) because it is interpreted as 8640000 seconds.

If no constraint scope (P4680) is specified, this constraint is checked everywhere.

Possible actions[edit]

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

  • It’s possible that the value in the statement is incorrect (e. g. due to confusing the thousands separator with the decimal separator) and should be fixed.
  • It’s possible that the current item should not have the statement at all, and that the statement should be removed.
  • It’s possible that the item is a rare, but legitimate exception to the constraint, and nothing should be done.

Parameters[edit]

On “quantity”-type properties, the following two parameters are mandatory:

minimum quantity (property constraint) (P2313)
The lower boundary of the permitted range. 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. no value Help can be used to specify a range with no upper boundary (). unknown value Help is not permitted.

On “point in time”-type properties, following two parameters are mandatory:

minimum date (property constraint) (P2310)
The lower boundary of the permitted range. no value Help can be used to specify a range with no lower boundary (). unknown value Help means the current date at the time the constraint is checked.
maximum date (property constraint) (P2311)
The upper boundary of the permitted range. no value Help can be used to specify a range with no upper boundary (). unknown value Help means the current date at the time the constraint is checked.

In both cases, the interval is always inclusive on both ends: the minimum and maximum value are both permitted values.

Examples[edit]

Example 1[edit]

Example setting for atomic number (P1086).

property constraint
Normal rank range constraint Arbcom ru editing.svg edit
minimum quantity (property constraint) 0
maximum value 155
▼ 0 reference
+ add reference
+ add value

Example 2[edit]

Example setting for retrieved (P813). "15 January 2001" is the day when Wikipedia went online (Wikipedia Day). "unknown value" is added to statements by clicking on the icon beside the value field that looks like this Wikidata snak icon.png. "unknown value" is interpreted as "now".

property constraint
Normal rank range constraint Arbcom ru editing.svg edit
minimum date (property constraint) 15 January 2001
maximum date (property constraint) unknown value
▼ 0 reference
+ add reference
+ 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.

Range from “+2001-01-15T00:00:00Z” to “now”: values should be in the range from “+2001-01-15T00:00:00Z” to “now”. (Help)
List of this constraint violations: Database reports/Constraint violations/P813#Range, hourly updated report, SPARQL (new)

Lists[edit]

Lists of properties which are set range constraint.