< Wikibase
Further information: phab:T69659

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

Example of TemplateData skeleton

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"

[{
P1234: 'foo'
}]

Resulting template

{{mytemplate|foo = P1234 value}}

Example

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

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

Tools supporting Wikidata maps

This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.