Representing page links changes as state will be useful for inputs to ML models (T328899), but will also be very useful for state transfer of page links state to other places.
We should create a common event data model for links on MW pages.
Here is a summary of different kinds of links: (copied from T333497#8772933).
| Type | Mediawiki table | Details |
|---|---|---|
| Classic wikilinks | pagelinks | blue text link to other pages on a wiki but doesn't have any special rendering, follow-on effects etc. Can be to any namespace and generally added via wikitext but can also be transcluded via templates etc. |
| Interwiki links | iwlinks | Like classic wikilinks but to a page on another wiki |
| Template links | templatelinks | Not wikilink to template namespace but template invocation via {{...}}. Still, has same mediawiki database pattern as wikilinks of source+target page information. |
| Category links | categorylinks | Not wikilink to category namespace but category invocation that sets a category for a page. Has same mediawiki database pattern of source+target page information with a little added complication related to category hierarchies etc. |
| Image links | imagelinks | Not wikilink to file namespace but image invocation that adds an image/audio/etc. to a page. Has same mediawiki database pattern of source+target page information |
| Language links | langlinks | Generally updated via Wikidata now but langlinks still stores the information and they can still be added to wikitext to link articles across projects/languages as being about the same subject. |
| External links | externallinks | also blue text link but to non-wikimedia page so more possibilities as to what they go to and treated very differently by end-users as a result. Also externallinks table truncates the link text column length which can result in incomplete links being stored in mediawiki's backend even as the wikitext retains the true value. |
In addition to the links listed there, we should include page redirect targets as a link type.
Looking at the different kinds of links, I can see two broad kinds: Links to MW pages (articles, templates, categories(?) images, etc.) and arbitrary hyperlinks to external URLs. If it is sane to put these kinds of links in the same data model, we should, but perhaps external links are different enough to warrant their own data model. This ticket should be used to make and document this decision.
Done is
- A new mediawiki page link state entity data model is bikeshed and decided on
- A new mediawiki.page_links_change.v1 stream is produced via EventBus extension. This stream should likely only contain normal wiki page links.
Other streams that represent links should use this new mw link data model.
- T221397: Store page-links-change data in a database table and make available through a Special page (T221397#7472265)
- T300222: Implement normalizing MediaWiki link tables and T222224: RFC: Normalize MediaWiki link tables (description of problem)
- T328899: Add a new outlink topic stream for EventGate main
- T333497: Include image/file changes in page-links-change
- T370378: Explore usage tracking for chart pages and tabular data pages
Other related tasks:
- T216504: page-links-change stream is assigning template propagation events to the wrong edits
- T303907: EventStream (page-links-change) is not accurate
- T290211: EventStreams sending same data over and over (page links change)
- T216492: Page-links-change stream doesn't capture duplicated links
- T373644: Provide data on whether the file itself was changed in mediawiki.page_change.v1 event