Special property "Display precision of"

From semantic-mediawiki.org
Display precision of
Allows to define the display precision in digits
Further Information
Provided by: extension "Semantic MediaWiki "Allows to store and query data annotated to pages
Added: 2.4.0
Removed: still in use
Alias: has no alias
Optional: no
Visible: yes
Annotable: yes
Declarative: yes
Key:
_PREC
Setting: not specified
Focus: not specified
In this wiki: Property:Display precision of
Table of Contents

The Display precision of property is a special property in Semantic MediaWiki with a built-in meaning: it adds the possibility to specify a display precision for numeric datatypes, i.e. datatype "Quantity"Holds values that describe quantities, containing both a number and a unit, datatype "Temperature"Holds temperature values (similar to type Quantity) and datatype "Number"Holds integer and decimal numbers, with an optional exponent. It was introduced starting with Semantic MediaWiki 2.4.0Released on 9 July 2016 and compatible with MW 1.19.0 - 1.27.x..1

See the property page "Display precision of" to see which pages use this special property on this wiki.

Example[edit]

The page of a property called "Has area" might contain:

[[Display precision of::2]]

This will set the display precision for the data values assigned to the respective property to two. Note that rounding applies, i.e. a data value of "123,4567" will be shown as "123,46".

Query printout precision[edit]

A printout precision denoted in an #ask query using -p<digit> will override a possible predetermined precision via the property page set by the "Display precision of" special property.2

Syntax
{{#ask:
 [[Category:City]]
 [[Has area::+]]
 |?Has area|+align=right
 |?Has area#-n-p2|+align=right
 |?Has area#m²-p3|+align=right
 |mainlabel=City
}}
Result
CityHas areaHas areaHas area
Amsterdam219.00 km²84.56 sqmi <br />219.00219.000 km²84.556 sqmi <br />
Berlin891.85 km²344.34 sqmi <br />891.85891.850 km²344.343 sqmi <br />
Cologne405.02 km²156.38 sqmi <br />405.02405.020 km²156.378 sqmi <br />
Frankfurt248.31 km²95.87 sqmi <br />248.31248.310 km²95.872 sqmi <br />
Karlsruhe173.46 km²66.97 sqmi <br />173.46173.460 km²66.973 sqmi <br />
London1,706.80 km²659.00 sqmi <br />1706.801,706.800 km²658.995 sqmi <br />
Munich310.43 km²119.86 sqmi <br />310.43310.430 km²119.857 sqmi <br />
Paris105.40 km²40.69 sqmi <br />105.40105.400 km²40.695 sqmi <br />
Porto41.66 km²16.08 sqmi <br />41.6641.660 km²16.085 sqmi <br />
Rome1,285.31 km²496.26 sqmi <br />1285.311,285.310 km²496.258 sqmi <br />
San Diego963.60 km²372.05 sqmi <br />963.60963.600 km²372.046 sqmi <br />
Stuttgart207.35 km²80.06 sqmi <br />207.35207.350 km²80.058 sqmi <br />
Sydney2,058.00 km²794.59 sqmi <br />2058.002,058.000 km²794.594 sqmi <br />
Vienna414.87 km²160.18 sqmi <br />
1,073,815,073.82 km²414,600,000.00 sqmi <br />
414.87
1073815073.82
414.870 km²160.181 sqmi <br />
1,073,815,073.815 km²414,600,000.000 sqmi <br />
Warsaw516.90 km²199.58 sqmi <br />516.90516.900 km²199.575 sqmi <br />
Würzburg87.63 km²33.83 sqmi <br />87.6387.630 km²33.834 sqmi <br />

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:1335
  2. ^  Semantic MediaWiki: Sandbox example for pull request 1335