Page MenuHomePhabricator

Check constraints before saving statements
Open, LowPublic


It would be great to check constraints on a new or edited statement before it is saved, so that possible errors can be corrected before the incorrect statement is added.

(I think this feature has been planned, at least as a “nice to have for the future”, for some time – I remember it came up when the API was added – but as far as I can tell we didn’t have a task for it before.)

On a more technical level, this means adding support for passing JSON snippets (for snaks, statements, of even full entities?) instead of entity or claim IDs into wbcheckconstraints (or a new API module?), which could also be used externally, e. g. before a large data import. (For instance, the HarvestTemplates tool already includes a partial implementation of constraint checks, and aborts imports which fail some constraints.)

Event Timeline

Let's please only do this once we have the current checking in a good shape and integrated well. I want feedback for that and cleaned up constraints before we take that step. I also want to see how much bad editing is done because of them before we move on.

One concern here (apparently not mentioned before) is that not all constraints can be satisfied by a single edit, for example “symmetric” and “inverse”.