Page MenuHomePhabricator

TemplateData: TemplateData should have a parameter to support Wikidata
Open, MediumPublic


TemplateData should have a parameter for linking to Wikidata, and then pull information from there if applicable.

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:25 AM
bzimport added a project: TemplateData.
bzimport set Reference to bz67659.
Keegan created this task.Jul 8 2014, 5:50 AM

@Keegan could you elaborate, please?
Are you proposing a new parameter type?

matej_suchanek added a project: Wikidata.
matej_suchanek set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 13 2015, 8:19 PM
Lydia_Pintscher moved this task from incoming to monitoring on the Wikidata board.Aug 17 2015, 2:51 PM
eranroz added a subscriber: eranroz.Oct 3 2015, 7:14 AM

TemplateData is a general purpose metadata definition for templates and isn't aware to other extensions (Wikibase, VE, Citeoid etc) - so it is invalid to create special definitions for wikidata.
But what we can do is to agree on a convention for maps for wikidata, similar to Citoid:

Once we have such maps we can use them to build tools that integrate wikidata in Wikipedia (or in general - on the client side) more easily such as:

  • Client side editing of Wikidata / Templdate editor in VE
    • indicate a parameter is already in wikidata and doesn't need to be filled
    • a parameter is missing in wikidata and can be exported to wikidata from Wikipedia.
  • tools for consistency checking across different wikipedias

I just wrote an example for it on mediawiki:

This is nothing to do with pulling information from wikidata - TemplateData is just a metadata description, while pulling of the data is the business logic and can have various implementations ({{#property}}, Scribuntu, template editor of VE etc)

Here is a proof of concept how to map wikidata properties to parameters and why it is cool:

  • open VE and add new template of Cite web. Note that the mapped parameters are getting translated in the VE template editor.
-jem- added a subscriber: -jem-.Mar 30 2016, 11:44 AM
Krinkle removed a subscriber: Krinkle.Jun 2 2016, 9:13 PM
Trizek-WMF added a subscriber: Trizek-WMF.EditedJun 15 2016, 7:59 AM

I have a similar request here: some people want to have a way to know if a piece of data from Wikidata will be automatically transcluded when they edit a template (especially infoboxes).

TheDJ added subscribers: Mike_Peel, TheDJ.EditedJun 25 2016, 2:14 PM

Was discussing this some more with @Mike_Peel after his Wikidata + Wikipedia integration talk at Wikimania

Example template that uses Wikidata: Infobox telescope

Article fully using WikiData for the infobox. No local data. South Pole Telescope

Article using local data overrides for several paramaters of the infobox: LIGO

I added Templatedata to that infobox to experiment a bit more with how this works in terms of interface, so we can play around with infoboxes as well.

Some ideas:

  1. In templatedata, we could have autovalue point to a Q item perhaps.
  2. When we have this, we could show these parameters in the VE template editor, which is less confusing than having a lot of data and no way to edit it, and worse not even represent this data in the editor, even though it is in the article.
  3. A next step could be to link to the wikidata editor of this property in a new window.
  4. How do we deal with 'hiding' the autovalue. Currently in wikitext we do this by defining the parameter but not defining any content for it. This seems a bit confusing in the VE interface to me. Maybe we can think of a better solution.
  5. Some parameters use multiple wikidata properties, or a chain of fallback properties.. More difficult to model with just autovalue...
  6. Note that the scribunto modules backing this template also include formatting options etc etc. The full solution is more complicated than the pure data...
eranroz added a comment.EditedJun 30 2016, 4:18 AM

Just to comment to TheDJ example, in hewiki we use meta template (actually - Lua Module) for wikidata integration in standard infobox:

To define a infobox template using wikidata we use the following syntax:

|label1=Birth date
Mvolz added a subscriber: Mvolz.Jul 29 2016, 3:09 PM
putnik added a subscriber: putnik.Aug 11 2016, 2:03 PM

I just wrote an example for it on mediawiki:

The problems of mapping properties for Wikidata (unlike Citoid) that

  1. we have a lot of similar properties, which names are simplified when they are inserted into infoboxes; it's your example of mapping, little extended:
"maps": {
    "wikidata": {
        "P17": "Country",
        "P27": "Country",
        "P41": "Flag",
        "P495": "Country",
        "P1532": "Country",
  1. some fields work with a chain of properties, e. g. if there is no P1532, we should use P27 instead.
hoo added a subscriber: hoo.Aug 11 2016, 2:41 PM
Mvolz added a comment.Aug 12 2016, 2:00 PM


Could you expand a little bit? Are you saying that the maps is insufficient to work with wikidata?

So in citoid, we have a similar thing, where the citoid service may return the field name "blogTitle" or "websiteTitle" for the template field name "website" in Cite web. It's basically exactly as you've written it out there. Then in the extension we just pick the last one in the list to fill. Could the template do this? Just cycle through all the ones that are "Country" and put it whichever one that has the value and is last or first in the list?

So in that scenario, you'd just put P27 first and P1532 second, and then if there was no P1532 it would be put in from P27.

If maps *isn't* working for you, we could definitely explore expanding it to work for wikidata. We intended 'maps' to be flexible enough to work for any service, but at the time citoid is the only one that was using it so it was hard to predict what that general use case was.

A very closely related issue: T138219.

hewiki is using "wikidata" map extensively:"wikidata"%2F&title=מיוחד:חיפוש&profile=advanced&fulltext=1&ns10=1

This is used by multiple gadgets and user scripts including:

  • TemplateWizard (a wikitext equivalent for Template Dialog in VE) - Shows as placeholder the formatted values for fields fetched from wikidata.
  • harvestLabel - using the wikidata map to extract field from template and suggest to use the field as label in wikidata (semi automatic)
geraki added a subscriber: geraki.Jun 27 2017, 1:13 PM
He7d3r added a subscriber: He7d3r.Feb 3 2018, 1:25 PM
Mgns added a subscriber: Mgns.Feb 5 2018, 1:06 PM
Samwilson added a subscriber: Samwilson.

Change 446978 had a related patch set uploaded (by Eranroz; owner: Eranroz):
[mediawiki/extensions/TemplateWizard@master] Wikidata support for TemplateWizard

kaldari added a subscriber: kaldari.EditedMay 1 2020, 12:42 AM

Putnik's problem is common, but should be relatively easy to deal with (per Mvolz). Where we really run into problems is with the reverse situation: where Wikidata properties conflate multiple concepts that may be handled distinctly in Wikipedia infobox parameters. Many Wikidata properties are vague or inconsistently used due to Wikidata's fuzzy, must-fit-all-languages ontology.

Examples of properties that explicitly conflate distinct concepts:

  • P21: sex or gender (which is also clumsily used to handle transgender status, i.e. "transgender male")
  • P61: discoverer or inventor
  • P629: edition or translation of

Examples of properties that are implicitly vague:

  • P131: located in the administrative territorial entity (notice how the South Pole Telescope is located at "South Pole, Antarctic Treaty area" rather than "South Pole, Antarctica" as it would be if we weren't using Wikidata)
  • P171: parent taxon (which can in practice correspond to any taxon level: genus, tribe, family, etc.)
  • P361: part of
  • P571: inception (which is so vague it has 57 English-language aliases listed on Wikidata, including both "start date" and "completed")
  • P642: of
  • P828: has cause

If we go down this road, we're going to be muddying Wikipedia's more-or-less clearly defined infobox parameters with awkward, inconsistent data (or data suggestions) that may not fit a particular language's understanding of a concept or ontology. P21 and P571 are the most likely to cause obvious problems, but I feel like it's only the tip of the iceberg, and we need to consider this carefully before we open up pandora's box.

RexxS added a comment.May 1 2020, 6:16 PM

The reason why The South Pole Telescope has the location "South Pole, Antarctic Treaty area" is that according to Wikidata, the South Pole is not located in Antarctica; it's only located in the administrative territorial entity of the Antarctic Treaty area. That's just a simple mistake in the organisation of Wikidata, and nothing to do with fetching Wikidata for infoboxes. As it stands, no SPARQL query for what's located in Antarctica will give you the South Pole, which is a bit worrying.

If we go down this road, we're going to be muddying Wikipedia's more-or-less clearly defined infobox parameters with awkward, inconsistent data (or data suggestions) that may not fit a particular language's understanding of a concept or ontology. P21 and P571 are the most likely to cause obvious problems, but I feel like it's only the tip of the iceberg, and we need to consider this carefully before we open up pandora's box.

Of course there are issues with Wikidata, but this bug doesn't suggest forcing the usage of Wikidata in all the parameters of all the infoboxes in Wikipedia in all languages. It only suggests adding an option to support Wikidata in TemplateData, and people will use it wherever everyone agrees that it's useful. There are lots of places where it is, and some muddy areas are not a reason not to use it anywhere.