Template:Data Swaden

This template contains sindry independently retrievable data items anent Swaden in the form of parameter values o a variable template o walin, in a standardised fashion. It is a member o a faimily o templates, those wi names stairtin wi "Data" in Category:Data templates.

Parameters

eedit
Parameter name Value Meanin
1 Swaden last pairt of template name, uised tae identify it within the faimily of templates[1]
article article name; needs tae be specified anly if it differs frae Swaden; in applications, uise [[{{{article|{{{1}}}}}}]] tae link tae the article (as haes been done at the tap of this page)
short name shorter display name tae be uised in some contexts; an application or application parameter can specify whether this is uised; anly intendit for dispensing wi disambiguation in a context whaur it is nae needed
type country teep of entity, e.g. continent, country, province, municipality
code code
code description code description
continent Europe continent, if type is lawer than "continent"
country country, if type is lawer than "country"
province province, if type is lawer than "province"
popbase 10,019,400 population on a gien date (stored wioot commas)
popbaseyear 2017 year for which the population base figure applies
popbasemonth 2 month for which the population base figure applies
popbaseday 28 day for which the population base figure applies
popinc 470 population increase per day; uised tae extrapolate the population figure
land area 410,335 land aurie in km2 (stored wioot commas)
total area 450,295 tot aurie in km2 (stored wioot commas)
flag image Flag of Sweden.svg name o the banner image (or ither illustration, if thare is no banner) shawn abuin

Throughout the faimily of templates, fixed names are uised for the parameters. (The parameter names are kept short tae reduce counts for the post expand include size an the template argument size in cases whaur thir are applicable.) Houiver, nae necessarily aw parameters hae been gien a value: some parameters mey nae be applicable, while for some ither parameters the value mey juist hae nae been specified yet. The table shows aw parameters, an for each the value, if specified.


eedit


Derived data

eedit

The population today is 11,350,000.[2]

The population is 0.139% of that o the warld. It is Expression error: Unrecognised punctuation character "[".% of that of Europe.

The total area is 450,295 square kilometre (173,860 sq mi). It is 0.302% of the land area of the world. It is Expression error: Unrecognised punctuation character "[".% of that of Europe.

The water area is 8.9% of the total area.

The population density is 27.7 per square kilometre (71.7/sq mi) land area.


Retrieval of data items

eedit

{{data Swaden|pst2|land area}}, uisin parameter selection template Template:Pst2, gies the parameter land area, etc.

For retrieval of mair data items it is mair efficient tae prepare a template for that, tae be uised as follows:

{{data Swaden|template name|..|..|..|..}}

sae that this data template needs tae be cried anly ance.[3] The default template is Template:Show data, producin this page.

The fower parameters are optional, thay are passed on tae the prepared template as parameters 2-5.

Special templates:

A parameter bein undefined or empty teepically means the same, see ablo. {{data ..|pst2|..}} gies the empty string an the text "{{{..}}}", respectively. Therefore an application checking the parameter haes tae check baith. Checking whether a result is equal tae e.g. the text "470" canna be done directly wi #ifeq in a template which itself haes an aa a parameter wi that name, acause if that is defined, thare wad be a comparison wi the value instead o the text itself. Instead, it can be checked whether the first character o the result is "{", e.g.: {{#ifeq:{{padleft:|1|{{data {{{continent}}}|pst2|popinc}}}}|{|..|..}}.

Creating new data templates

eedit

Template:Data/preload can be uised tae creaut new data templates. On the page o the data template o a province, if thare is no data template yet for the country, a link appears tae creaut that, preloading this template. Otherwise the wikitext can be copied tae the new data template. For parameters which are nae applicable, sic as country for a country, the parameter definition "country=" can be deleted. For parameters tae be filled in later the parameter definition lik "popinc=" (specifying the empty string as value) can be left in the wikitext tae be filled in later. Do nae forget parameter 1.

Efficiency

eedit

In this template system ilka template contains sindry properties o a single entity, as opponed tae the ither common system, whaur a template contains ae property (e.g. population or area) o mony entities. Awtho that ither system can be convenient gin updates o a property for aw thir entities become available thegither, in the case of muckle-scale uise of data on ae page that ither system can be problematic acause o its inefficiency. This is acause o the follaein:

  • Thare are eften mair entities than properties, an page counts (or in the case of #switch, average page counts) are proportional tae the nummer of data items in the data template (if thay are stored in a linear wey, nae in a tree, an nae stored as unnamed parameters).
  • In the case of lairge-scale uise of data on ane page thare are uisually ane or mair tables, whaur an entity forms a row and a property a column, acause thare are eften mair entities than properties, an acause this wey the sorting featur allows sorting entities based on a property. In this template seestem this allows producin a row wi anly ane caw o the data template, makin the count nae grow faster than proportional tae the average nummer of data items stored per data template, times the nummer of entities in the table.

The include pairt o the data template of an entity daes nae contain a lang leet of its sub-entities or thair properties, acause that wad mak this method inefficient too.

  1. It may seem odd, but a template cannot retrieve its own name (PAGENAME only provides this on the template page itself), and even if it could, a string operation would be needed tae remove "Data ". Putting the name of the entity in the data template removes the need tae supply it as a parameter when the data template is called (in the cases that it would need this name).
  2. Estimated by extrapolation.
  3. See the first two rows of the first table in m:Help:Array#Summary of counts for template limits.

Until here the documentation is automatically generated by Template:Show data.


References

eedit