Wikibase/Maps TemplateData

From mediawiki.org
Further information: Help:TemplateData
Further information: phab:T69659

Various tools support TemplateData maps for mapping between parameters and their corresponding Wikidata properties.

Example of TemplateData skeleton[edit]

Below, a barebone example of templateData that shows you how the 'maps' key fits in with the rest of the templateData. 'maps' values correspond to the name of the service being used, in this case 'wikidata.'. The values in the wikidata object must be valid 'params' (i.e. in this case, 'foo' - aliases are not allowed); 'maps' keys, i.e. 'bar' here, correspond to keys coming from the wikidata service.

"description": null,
"params": {
    "foo": {
        "label": null,
        "description": null,
        "default": null,
        "example": null,
        "required": false,
        "suggested": false,
        "deprecated": false,
        "aliases": [],
        "type": "unknown",
        "autovalue": null
    }
},
"paramOrder": [
    "foo"
],
"sets": [],
"maps": {
    "wikidata": {
        "P1234": "foo"
    }
}

A wikidata bound parameter with the field "P1234"[edit]

[{
P1234: 'foo'
}]

Resulting template[edit]

{{mytemplate|foo = P1234 value}}

Example[edit]

This is a full example of a template and maps for wikidata.

Template:

{|
! Country || {{{Country|{{#property:P17}}}}}
|-
| colspan="2" | {{{Flag|[[File:{{#property:P41}}|200px]]}}}
|}

Template data (maps part):

"maps": {
    "wikidata": {
        "P17": "Country",
        "P41": "Flag",
    }
}

Available fields and field structure[edit]

A complete list of fields are defined in wikidata:Special:ListProperties

Tools supporting Wikidata maps[edit]