Page MenuHomePhabricator

Parameter for linking a new page to Wikidata
Open, Needs TriagePublic

Description

As a template creator I want to be able to specify the Item ID for a new article via a URL parameter in order to make it easier to automatically connect the newly created article to the correct Item.

As an editor who is creating a new article I want to be able to preview my article with an infobox that is automatically filled from Wikidata immediately in order to see how it will look after saving.

As a Wikipedia editor I want to be able to create an article that will be automatically connected to a specified Wikidata Item when I save the new article.

Problem:
There is currently no way to specify the Item a new article should be connected to. This leads among other things to articles not being connected or being connected to the wrong Item.

Example:
Work-around on Russian Wikipedia: https://w.wiki/4fQp

https://ru.wikipedia.org/w/index.php?title=%D0%A2%D1%83%D1%80%D0%B5%D1%86%D0%BA%D0%B0%D1%8F_%D0%B2%D0%BE%D0%B5%D0%BD%D0%BD%D0%B0%D1%8F_%D0%B0%D0%BA%D0%B0%D0%B4%D0%B5%D0%BC%D0%B8%D1%8F&action=edit&itemid=Q1234

BDD
GIVEN a redlink incl an itemid parameter
WHEN clicking the redlink and opening the editor then the Item ID is handed over
AND WHEN clicking save
THEN the newly created article's sitelink is added to the Item with the specified ID

GIVEN an editor window for a new article with a specified Item ID
WHEN clicking preview
THEN the preview of the article makes use of the data from the specified Item

Acceptance criteria:

  • URL parameter is available and used in the new article wikitext editor
  • preview of the article from the wikitext editor includes data from the specified Item if the templates in the wikitext call it

Open questions:

  • How will this all work with VisualEditor?

Original report:
We need to create a GET parameter that will allow us to specify the ID of the Wikidata item when creating a new page in wiki projects. In case this parameter is specified, then

  1. the article in the preview should be able to get values from the Wikidata item, as if it is linked to the item,
  2. after saving the page, it should automatically link to the Wikidata.

Event Timeline

putnik renamed this task from Parameter for linking a new article to the Wikidata to Parameter for linking a new page to the Wikidata.Oct 15 2017, 11:55 AM

Hi,

Kateryna is working on this: https://meta.wikimedia.org/wiki/Research:Matching_Red_Links_with_Wikidata_Items

Please ping or write something in the discussion page if you want to know more about that project.

This is very good idea,. However, the task description is slightly too technical, e.g can someone add a kind of "user story" to explain how a regular user is expected to link between the article to be created and Wikidata entity? (I'm missing what, if any, user interface support for it should be made)

I imagine that the following UI components are to be affected:

  1. wikitext editor - some additional field (possibly with autocomplete) to link to entity
  2. VisualEditor - it should be possible in the advanced options to link article to item
  3. ContentTranslation - content translation should be aware to it without explicitly setting the item.

If this is correct, this means 2 implementations in the backend side?

  1. index.php?action=edit - e.g for the classic usage
  2. RESTBase-API the new contenttranslation is using REST-base and we need it there too (see also T199310)

This is very good idea,. However, the task description is slightly too technical, e.g can someone add a kind of "user story" to explain how a regular user is expected to link between the article to be created and Wikidata entity? (I'm missing what, if any, user interface support for it should be made)

In my opinion, you described rather a large topic, which combines many different tasks, and each of them can be implemented. But at the same time, they are completely independent and can be done in small iterations. Specifically, this task is solely about the wikitext editor, as described, and does not pretend to solve all problems at once.

API support can also be useful, but the API already allows to solve this with two requests. VE could also already link new pages by making these two requests, but it has no source to take the ID to do this (and if this task is done, it will be able to take it from the GET parameter). True, with VE there is another problematic part: previewing a page that has not yet been created (using a Wikidata item). So almost every part can be done separately and does not block any other.

The user story behind this is quite simple: for more than five years, modules that output information from Wikidata can also generate links for creating new articles, which already can include the necessary IDs. That is, it does not require any user interaction and no fields to select the right Wikidata item (although this can be added later as a separate task). In this case, it would be possible for users to start creating an article not from scratch, but at least with a filled infobox.

At the moment ruwiki has learned how to do this through editintro and the item ID template parameter (e.g. https://w.wiki/4fQp), but this looks more problematic, requires much more effort from the communities to support, and accordingly scales much worse.

Lydia_Pintscher renamed this task from Parameter for linking a new page to the Wikidata to Parameter for linking a new page to Wikidata.Jan 13 2022, 6:02 PM

I want to describe how things are (almost) implemented in ru-wiki to give some context regarding how this functionality can help community.
The desired user story is pretty simple:

  1. When I'm editing an article and have a red link, but knows that article exists in another language wikipedia, I'm leaving a hint there (e.g. {{Interlanguage link|Arthur Kaan|de||vertical-align=sup}} in en-wiki)
  2. When someone else is clicking on the red link ...
    1. ... browser open an article creation page with some content pre-generated based on wikidata (e.g. correct infobox) and language sitelinks are already displayed
    2. ... preview shows infobox populated from the specified wikidata item
    3. ... and save article, it automatically placed as a sitelink in the corresponding wikidata item

In order to achieve this, in ru-wiki we have several components:

  1. Most of infoboxes accept parameter from= (e.g. {{Infobox enzyme|from=Q1262082}}), so it can be used to display infobox for (yet) non-existing article
  2. Infobox modules, that shows info from wikidata are able to show redlinks and associate it with wikidata element (both visually and via url parameter from=Q1117754) see
    Screenshot 2022-01-14 10.02.18.png (43×339 px, 5 KB)
  3. JS-gadget, that
    1. looks for interlanguage links such as {{Ill|HD 165493|it}}
    2. gets wikidata element (Q2399598) for https://it.wikipedia.org/wiki/HD_165493
    3. adds from=Q2399598 to red link url
  4. JS-gadget, that invoked when a new article page is opened (e.g. url contains redlink=1) and url contains from=Qxxx This gadget
    1. finds an appropriate infobox and put it in the article text with from parameter
    2. generates human-readable article preamble based on wikidata item
    3. shows language links
      canvas.png (1×2 px, 1 MB)
  5. Bot that monitors newly created articles and
    1. adds article as a sitelink to the corresponding wikidata item (e.g. https://www.wikidata.org/w/index.php?diff=1397217877)
    2. removes from= parameter from the infobox (e.g. https://ru.wikipedia.org/w/index.php?diff=113447669)

How native support of from=Q1234 (or itemid=Q1234 like proposed above) url parameter could simplify those five components?

  1. If parser functions invoked on non-existing page will consider this url parameter, we won't need from= parameter in infoboxes. Ru-wiki already invested into that, but a lot of other communities does not, so this will save them a lot of effort
  2. Nothing really changed here. Server-side generation of redlinks with new parameter is bad idea, so we recommend to keep it on js-gadget (code is trivial, but unfortunately depends on the formatting, that differs from project to project)
  3. Same here, we will keep it in js-gadget, (wbgetentities + above)
  4. We will still have to do A and B, but C will be done for us by engine
  5. That piece can be done by engine easily. Existing bot runs once a day, so for majority of new articles sitelinks are added manually. We are planning to rewrite bot so it will monitor Page creation stream, but streams are not particularly reliable

So to summarise, this feature (with small additional contribution from community) can effectively helps editors to create new articles more efficiently and provides clear incentives to enhance wikipedia-wikidata integration.