Page MenuHomePhabricator

Link Types: easy addition of structured metadata added to hyperlinking dialog in VE
Open, LowestPublic


CONTEXT: adding structured metadata to articles is a complex issue. This feature is intended to provide a minimal capability that keeps control in the hands of editors and enables strong typing on links between articles.

USER STORY: As an editor using VE to write an article about a well structured type of entity, such as a person, company, chemical, or event, I want to be able to mark key attributes and relations in the body text with metadata that allows the wiki system to apply strong typing to both the string and the form of the attribute or relation connecting the subject of the article as expressed in the title to that string. For example, when writing an article about a French person, I would like to be able to highlight the word "French" and hyperlink it to the article on the French people and simultaneously mark it as the nationality of the person. This would allow the wiki system to populate the nationality field in a summary about the person, and also enables search for people with that nationality.

SIMPLIFICATION: the concept of strong typing can go haywire. This kind of feature could easily get super complicated with typing appearing on the current article, and the string being linked, and the thing it is linked to, and implied graph edge between this article and that article, etc. So! we should keep this as simple as possible. The proposal is to impose typing only on the edge, which articulates the way in which the subject of the present page (whatever it is) relates to the subject of the linked page (whatever that is).

INHERITANCE: This approach leads to the use of a fundamental "is instance of" relation for typing, also known as "isA" relations. This naturally leads to inheritance of types. For example, when writing an article about an NFL football coach, they can add a hyperlink to an article on NF Coaches with an "is instance of" type on the link, and that article can have an "is instance of" link to an article on Coaches, which itself has an "is instance of" link to Person, which itself has an "is instance of" link to Animal. Through this chain, the present article on a particular coach will inherit the type Person and Animal. The NFL Coaches article might also have an "is instance of" link to an article on National Football League Staff, or alternatively a link to an article on the NFL with a link type of "is staff member of".

COMPARISON: Wikipedia attempts to solve a related problem by putting pages into categories. Instead of associating an article about a football coach with an article on Person, wikipedia puts articles into Categories, such as Living People. While the subject of heated debate, I believe at least some community consensus has come around to the opinion that using categories in this way is inferior to putting types on links to articles.

TYPES: The labels applied to links are described by records of some kind in the wiki. This is a crucial implementation issue, and the focus of the implementation discussion below.

As further examples, when writing an article about a _____________, I would like to be able to highlight a ________ that I just typed or pasted into the article to create a hyperlink and mark that hyperlink as a _____________ type of relation.

NB: in this type, the first two columns are merely descriptions to provide context in this discussion; they are not strong types applied out of thin air :-)

Article ContextHighlighted StringTyped RelationshipNote: only the relationship is labeled with a strong type
cyber attackIP addresscommand and control node used in the attack
cyber attackIP addressvictim of the attack
cyber attackIP addressmachine used in a botnot
cyber attackCyber Incidentis instance ofNote: see inheritance discussion above
companyaddressbranch office
companyaddresshead quarters
personemail addressused by
personPersonis instance ofNote: see inheritance discussion above
personFoot Ball Coachis instance ofNote: see inheritance discussion above
personother personwrote book with
personother personorganized an easter egg hunt on the East Lawn with

DIVERSITY: The list of relation types is as diverse as Wikipedia itself, so I would like to be able to pick from existing link types and also be able to enter new values when needed.

RED LINK PROBLEMS: If I create a link to an article that does not exist, then I risk having some create that article with something different than I intended. This proposal does not address that issue. If I use a link type that does not yet exist, then I am taking the same risk. It is up to the editor to populate the new articles to which they link, and also to populate the new link types that they assert when linking.

UNTYPE LINKS: the default link type should be "undefined" or None or NULL because that is the case today. This is not just for backwards compatibility. Editors should not be required to assert a link type.

SINGLE ASSERTION: each link has exactly one type. It can be modified by subsequent editors.

IMPLEMENTATION: This functionality could be relevant to TemplateData, WikiData, and Semantic MediaWiki. Exactly which to use and how is part of the technical task requested by this ticket. The desired end result is a modified hyperlinking dialog that enables this functionality.

LOOKAHEAD: The visual dialog that helps users apply a type to a link should provide lookahead suggestions as they use their keyboard to enter the name of the type. At least initially, the lookahead functionality should be simple and not worry about the complexity or hierarchy of possible types. A full "browser" of possible types can be a subsequent ticket, possibly related to T94296.

Event Timeline

Jrf assigned this task to tosfos.
Jrf raised the priority of this task from to Needs Triage.
Jrf updated the task description. (Show Details)
Jrf added a project: VisualEditor.
Jrf subscribed.
Jrf set Security to None.

This seems like this would be better done through Wikidata. There are some other tasks around for editing Wikidata through VisualEditor (so that it's an integrated experience) – not sure what you're looking for here, however.

@Jrf, I'm marking this stalled since it's not clear how you envision this integrating with Wikidata. If you need to learn more about Wikidata, I'd check out its introduction page or ask questions at its projects chat page. I'm not an expert on Wikidata, but let me know if there's anything I can help you with!

Thanks to Nischay's efforts, we have a mostly working dialog box for adding properties to links --- the user story works very well. This will be available in a public git repo as soon as Nischay pushes it. It has one bug and one missing feature. We hope to get guidance from the VE dev team on these two issues:

  1. (bug) the default VE mouseover popup on a link now shows incorrect info: it shows a link to a page with title = "my_prop_name::MyTitle" and instead it should link to a page with title="MyTitle". The link mouseover popup would ideally also show a link toProperty:my_prop_name.
  1. (enhancement) the link icon in the main toolbar and control-K keystroke would ideally be replaced by the new LinkTyping dialog.

I made a video of the one remaining issue with making this work well:

The larger issue of taking over the Link creation dialog is a separate goal/task/issue.

Aklapper added a subscriber: Nischayn22.

@Nischayn22: I am resetting the assignee of this task because there has not been progress lately (please correct me if I am wrong!).
Resetting the assignee avoids the impression that somebody is already working on this task. It also allows others to potentially work towards fixing this task.
Please claim this task again when you plan to work on it (via Add Action...Assign / Claim in the dropdown menu) - it would be welcome! Thanks for your understanding!

Aklapper changed the task status from Stalled to Open.Nov 1 2020, 8:54 PM

Author has answered questions in T94295#1286199 hence resetting task status.