Page MenuHomePhabricator

Improve constraint violation messages
Closed, DuplicatePublic


Some of the constraint violation messages are hard to understand. This one is, in my opinion, particularly bad:

This property's value entity must be in the relation to the item (or a subclass of the item) defined in the parameters.

Example violation: Douglas Adams has religion: atheism, but atheism is not an instance of religion, which the religion property demands.

All the important information you need to understand this message – that the relation is “instance of”, and that the class is ”religion” – is hidden in the parameters, which the user script doesn’t display at all!

We should include this information in the message (hyperlinked), and also split up this particular message into two, one for “instance of” and one for “subclass of”. Suggestion:

This property’s value (atheism) must be an instance of religion, Christian church, or religious denomination (or a subclass thereof).

Perhaps the list of classes needs to be truncated if it’s very long, but most of the time I hope we should be able to include it fully.

Jan also suggested including the property name in the message. Perhaps something like this?

The value for religion (here: atheism) must be an instance of…

An entirely different question is whether we want to assemble this message server-side or in the user script. The API already returns all the information required to assemble the message (constraint type and parameters), but currently the message is built on the server, which keeps the client very simple (it doesn’t have to retrieve labels or know about translations).

T102758 seems to be related to this, but it seems unclear if anyone still knows what to do with that task.

Event Timeline

also hard to grasp: inverse violation (on this item)

Status: violation
Message: This property must only be used when there is a statement on its value entity using the property defined in the parameters and this item as its value.
Constraint: Inverse

Yeah. If we include the parameters in the message, I would phrase that as:

If “Q3971211” has the statement “part of” “Adriatic railway”, then “Adriatic railway” should also have the statement “has part” “Q3971211”.

(I probably wouldn’t put quotes in the real message, that’s just to indicate what parts would be hyperlinked.)

Perhaps the end of the statement could be “should also have the inverse statement…”? Or is that confusing?

Even more natural English would be “If Q3971211 is part of Adriatic railway, then Adriatic railway must have part…”, but that requires too much knowledge about the constraint in question (which auxiliary verb to use).

>  If “Q3971211” has the statement “part of” “Adriatic railway”, then “Adriatic railway” should also have the statement “has part” “Q3971211”.

If we now replace the Q… with the label (and/or put the Q in brackets) than the message should be fine. (Or you already considered this, but noted, like me, that Q3971211 has no labels)

So it would say something like:
If ThisThing (Q123456) has the statement part of:Someotherthing, then sometherthing (Q654321) should also have the inverse statement has part:ThisThing