This page is protected against editing.

Template:Data

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Data/doc.

Retrieves data from Wikidata and formats them using Module:Wikidata. Same parameters as those listed in the formatStatements property defined by the module. Use with caution Module:Wikidata has a lot of bugs and this template often does not work as expected. It is often safer to use Module:WikidataIB

Usage

{{Data |item= |property= }}

Template parameters

ParameterDescriptionDefaultStatus
itemitemQ + numeric ID.emptyrequired
propertypropertyP + numeric ID of the property that the claims should have.emptyrequired
withqualfierwith qualifiersQualifiers that the statements should have.emptyoptional
withrankwith rankRank of the statement: preferred, normal, deprecated or valid (i.e. normal and preferred).preferredoptional
sourcepropertysource propertyProperty that items should have in the source.emptyoptional
withsourcewith sourceThe source that should be provided in the statement (if the sourceproperty parameter is not provided, the property used is stated in (P248)).emptyoptional
excludespecialexclude specialSet to true if you do not want to get novalue and somevalue.emptyoptional
numvalnumber of valuesThe maximum number of values to be returned.emptyoptional
sorttypesort typeSet to chronological to get the statements in chronological order (oldest first) using the start time (P580), end time (P582) and point in time (P585) qualifiers. Set to inverted for antichronological order (latest first). From a Lua module, you can also define your own sorting criteria.emptyoptional
showsourceshow sourceSet to true if you want the source of the statement to be displayed.emptyoptional
langlanguageLanguage code (only needs to be provided if the language displayed is to be fixed and independent of the user’s preferences).emptyoptional
targetvaluetarget valueThe property value that the statement should have (only works for item-type properties).emptyoptional
displayformatdisplay formatThe format in which the args should be returned. For example, for a string-type property displayformat=weblink returns a formatted weblink. All possible values:
  • raw
  • latitude and longitude - for datatype globecoordinate
  • qualifier - for datatype globecoordinate
  • function - for datatype wikibase-entityid
  • wikidatastyle - for datatype wikibase-entityid
  • weblink - for datatype string
  • id
emptyoptional
conjtypeconjunction typeThe conjunction separating the statements; for example, conj=<br /> will show each statement on a separate line.emptyoptional
showqualifiershow qualifierSet to true to indicate that the qualifiers should be shown after the main value of each property.emptyoptional
Template data
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

Retrieves data from Wikidata and formats them using Module:Wikidata. Same parameters as those listed in the “formatStatements” property defined by the module.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
conjunction typeconjtype

The conjunction separating the statements; for example, “conj=&lt;br /&gt;” will show each statement on a separate line.

Contentoptional
display formatdisplayformat

The format in which the args should be returned. For example, for a “string”-type property “displayformat=weblink” returns a formatted weblink.

Lineoptional
exclude specialexcludespecial

Set to “true” if you do not want to get “novalue” and “somevalue”.

Lineoptional
itemitem

Q + numeric ID.

Linerequired
languagelang

Language code (only needs to be provided if the language displayed is to be fixed and independent of the user’s preferences).

Lineoptional
number of valuesnumval

The maximum number of values to be returned.

Numberoptional
propertyproperty

P + numeric ID of the property that the claims should have.

Linerequired
show qualifiershowqualifier

Set to “true” to indicate that the qualifiers should be shown after the main value of each property.

Lineoptional
show sourceshowsource

Set to “true” if you want the source of the statement to be displayed.

Lineoptional
sort typesorttype

Set to “chronological” to get the statements in chronological order (oldest first) using the P580, P582 and P585 qualifiers. Set to “inverted” for antichronological order (latest first). From a Lua module, you can also define your own sorting criteria.

Lineoptional
source propertysourceproperty

Property that items should have in the source.

Lineoptional
target valuetargetvalue

The property value that the statement should have (only works for item-type properties).

Lineoptional
with qualifierswithqualfier

Qualifiers that the statements should have.

Lineoptional
with rankwithrank

Rank of the statement: “preferred”, “normal”, “deprecated” or “valid” (i.e. normal and preferred).

Default
preferred
Lineoptional
with sourcewithsource

The source that should be provided in the statement (if the “sourceproperty” parameter is not provided, the property used is P248).

Lineoptional

Additional information

The template is intended to be used in the following namespaces: no namespace specified

The template is intended to be used by the following user groups: no user group specified

See also

Example

Code Render Comment
{{Data|item=Q91|property=p31}} human
{{Data|item=Q91|property=p31|lang=ja}} ヒト
{{Data|item=Q91|property=p569}}
{{Data|item=Q91|property=p569|lang=ja}}
{{Data|item=Q12418|property=p186}} oil paint and poplar panel
{{Data|item=Q12418|property=p186|lang=ja}} 油絵具およびポプラ板
{{Data|item=Q12418|property=p186|rank=valid}} oil paint, poplar panel and wood rank = "valid" accepts both "preferred" and "normal" values
{{Data|item=Q12418|property=p186|showqualifiers=p518}} oil paint and poplar panel (painting support) shows the value of the p518 qualifier (if any) in addition to the main value
{{Data|item=Q12418|property=p186|qualifier=p518}} should only display values that have a p518 qualifier
{{Data|item=Q12418|property=p186|numval=1}} oil paint
{{Data|item=Q12418|property=P276|sourceproperty=P854}} Salle des États
{{Data|item=Q11879536|property=P460|source=Q1645493}}
{{Data|item=Q11879536|property=P460|source=Q1645493|showsource=true}}
{{Data|item=Q153|property=P231|showsource=true}} 64-17-5[1][2][3]
{{Data|item=Q205309|property=P793|sorttype=inverted}} closure, demolition, renovation, renovation, first match and construction
{{Data|item=Q205309|property=P793|sorttype=chronological|conjtype=<br />|withdate=true}}
{{Data|item=Q205309|property=P793|targetvalue=Q385378}} construction
{{Data|item=Q76|property=P856}} barackobama.com
{{Data|item=Q76|property=P856|format=weblink}} barackobama.com
{{Data|item=|property=p569}}
{{Data|property=P625|item=Q90|displayformat=latitude}} 48.856666666667

References

  1. ChEBI (title not provided in Wikidata), European Bioinformatics Institute, Creative Commons Attribution 3.0 Unported
  2. Global Substance Registration System (title not provided in Wikidata)
  3. CAS Common Chemistry