Page MenuHomePhabricator

[client editing] Mini hack-day to investigate how to communicate between WP-editor and WD-model
Closed, ResolvedPublic

Description

Motivation
With this mini hack-day we would like to find out if the idea of defining a declarative syntax (in JSON for example) to map user actions ("add new thing", "correct this") to changes on the statement according to the Wikidata data structures is feasible.

As an editor of an infobox on Wikipedia I want to add to/edit the content visible in the infobox but hosted on Wikidata without having to understand how the modeling of a statement/item works while also not accidentally messing up the structure of it.

Problem
Things are not modeled the same way in Wikipedia infoboxes and on Wikidata. There is the danger that if an editor makes an edit to a Wikidata-powered infobox in the usual way they would when it was wikitext, they would mess with the statement on Wikidata in an undesirable way.

Example
Adding the new mayor of Berlin to the Infobox on the Berlin article (assuming the changes have not been made on Wikidata yet, otherwise the infobox should have updated automatically).
What the editor is used to: Delete wikitext for old mayor and replace with wikitext for new mayor + sometimes the predecessor gets added with a start and end time in a different section.
What needs to happen on Wikidata: on the old mayor set rank from preferred to normal and add an end time + create new value for the statement with a preferred rank and set a start time in the qualifiers.

BDD
GIVEN an editor wants to update a mayor on a Wikipedia article
AND is unfamiliar with the modeling of Wikidata items(statements
WHEN they remove the outdated mayor
AND replace it with the new mayor
THEN this should get translated into the rank lowering of the old mayor and asking for an end date
AND setting the new mayor to preferred and asking for a starting date
AND thus make the right edits on Wikidata to the statement although the input on Wikipedia was different.

Acceptance criteria

  • have an idea by the end if this idea is a feasible solution to our problem.

Open questions

Slides

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Okay I did a little bit of work on this and it's way bigger than a mini hack-day to implement a basic prototype.
This is what I've got so far. There are several notes here:

  • ValueMapping is better to be done in frontend. In the backend it just doesn't work. Mostly because you can just turn value map to a set of API calls, result of API calls would determine the arguments of the next one. So something like Promise in javascript would come really handy in this case.
  • The proposed value mapper spec won't work. I came up with this but this also doesn't work. You can't say which value it needs to set.
{
  "veryFancyInputId": {
    "type": "item",
    "triggers": {
      "add": {
        "P27": {
          "rank": "preferred",
          "value": "#value"
        }
      },
      "set": {
        "P27": {
          "rank": "normal"
        }
      }
    }
  },
  "veryFancyInputId2": {
    "triggers": {
      "add": {"P17"}
    }
  }

ValueMapping is better to be done in frontend.

Is this currently done in the prototype on frontend or on backend?

The proposed value mapper spec won't work.…

I assume the set/add… directly map to Wikidata API calls, correct?

you can't say which value it needs to set.

Why is that? The value would be the value defined by the user via the input field, or do I interpret this wrong?