Page MenuHomePhabricator

Semantic template information in TemplateData
Open, Needs TriagePublic

Description

[This has been mooted numerous times in many different ways, hopefully this task can start to collect and organize some of them in addition to proposing a specific solution.]

Many different groups want to extract semantic information from templates, and some efforts have already been done to encode this with wikidata, eg CiteQ in T289287: Add support for the 'Cite Q' template to Citoid, T69659: TemplateData should have a parameter to support Wikidata, information about [[en:Template:Citation]] in https://www.wikidata.org/wiki/Q6925554 etc.

At present, groups such as research, mobile, VE/Citoid, Content Translation, etc use large hand-assembled lists of “what is the template on wiki X which corresponds to wiki Y” or “what are the infobox templates on wiki X” etc. This would provide a uniform mechanism to encode this information.

This has been proposed as a useful infrastructure feature numerous time, but like other cross-team proposals would benefit from being done initially in conjunction with a specific client team.

Event Timeline

https://www.mediawiki.org/wiki/Parsing/Notes/Wikitext_2.0/Typed_Templates is relevant in this context (not necessarily the proposal since that is half-thought out as a strawdog, but the discussion at least).

https://en.wikipedia.org/wiki/User:Cscott/Opportunities_for_Content_Transform_Team mentions both Subbu's Typed Templates proposal as well as a number of other possible initial clients/use cases.

T156876: Structured data side channel for wikitext is related. My proposal is to encode the structured data via TemplateData annotations, as described at T156876#11033397:

My inclination at the moment is to say that TemplateData is a good mechanism. Editors already know how to insert templates, and templates form the "microdata" mechanism of wikitext already. If you use {{author-birthdate|1976-09-27}} you're both allowing/enabling alternate styling of that information (including removing it from display entirely) as well as linking the TemplateData of author-birthdate to the parameters you've provided. If author-birthdate says (in its TemplateData) that argument 1 encodes https://www.wikidata.org/wiki/Property:P569 of its subject (the wikidata item associated with {{PAGETITLE}} by default, but presumably could be overridden by an optional second argument), we're most of the way there w/o using anything that editors aren't already familiar with.