Help:Property constraints portal/Units

From Wikidata
Jump to navigation Jump to search
Translate this page;
Other languages:
Deutsch • ‎English • ‎français • ‎polski • ‎српски / srpski • ‎العربية • ‎中文

This page contains changes. Please contact a translation admin to mark them for translation.


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

allowed units constraint (Q21514353) specifies that only a certain set of units may be used with a statement of the quantity data type.

For example, the only unit valid for timezone offset (P2907) is hour (Q25235).

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 unit is not the correct one to use for the quantity, and a similar but different unit should be used instead. Check the list of permitted units for an applicable unit to use.
  • It’s possible that the unit should not be specified at all (a dimensionless quantity), and that the unit should be removed.
  • It’s possible that the unit is a rare, but legitimate exception to the constraint, and nothing should be done.

Parameters[edit]

This constraint has one mandatory parameter:

item of property constraint (P2305)
Contains the permitted units. Must contain the allowed unit(s), which are either items or no value Help to allow dimensionless quantities. (unknown value Help is not permitted.)

Examples[edit]

Example 1[edit]

Unit for temperature (P2076) should be one of degree Celsius (Q25267), kelvin (Q11579), or degree Fahrenheit (Q42289).

property constraint
Normal rank allowed units constraint Arbcom ru editing.svg edit
item of property constraint degree Celsius
kelvin
degree Fahrenheit
▼ 0 reference
+ add reference
+ add value

Example 2 - no value[edit]

Mohs scale of mineral hardness (Q41472) is number used to represent hardness of materials. For example, quartz is 7, and diamond is 10. As definition, Mohs' hardness (P1088) doesn't have unit. In such case, "no value" is used as follows. "no value" is added to statements by clicking on the icon beside the value field that looks like this Wikidata snak icon.png.

property constraint
Normal rank allowed units constraint Arbcom ru editing.svg edit
item of property constraint no 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.

Units: “degree Celsius (Q25267), kelvin (Q11579), degree Fahrenheit (Q42289): value unit must be one of listed. (Help)
Exceptions are possible as rare values may exist.
List of this constraint violations: Database reports/Constraint violations/P2076#Units, SPARQL (new)

Lists[edit]

Lists of properties which are set allowed units constraint.