Jump to content

Wikidata: Enable the class and relation parameters on more constraint types (Community Wishlist/W4)

Long-term opportunity
From Meta, a Wikimedia project coordination wiki

View all wishes.

Description

Problem: Some extremely useful constraints cannot currently be created. Where a workaround is feasible, it results in large, difficult-to-maintain, and often incomplete constraints (examples below).

Proposed solution: Add support for the parameters class (P2308) and relation (P2309) to the none-of, item-requires-statement, and conflicts-with constraint types, to specify classes that property values may or may not belong to.

These parameters are already supported by subject-type and value-type constraints.

Or alternately, create three new constraint types with this functionality.

More details: These three constraint types support allowing or disallowing specific property values using item of property constraint (P2305), but they do not support allowing or disallowing classes of values.

This leads to 1) the creation of large, difficult-to-maintain, and often incomplete constraints (examples 1-3 below) that attempt to list every applicable property value, and 2) the absence of useful constraints when the values are just too numerous to list (example 4).

The effect of the solution will be to natively enable the three forms of constraint in green in the lower right of this table:

...one of these items, use: ...a member or subclass of these classes, use:
If the value of the statement... should be... one-of value-type
should not be... none-of none-of w/class+relation
If the value of another statement on the item... should be... item-requires-statement item-requires-statement w/class+relation
should not be... conflicts-with conflicts-with w/class+relation

Examples:

  1. This none-of constraint has 33 values of "item of property constraint", which are meant to include all recurring events, but are certainly not exhaustive. Instead, these could all be replaced with class (P2308) = recurring event (Q15275719), relation (P2309) = instance or subclass of (Q30208840), which would be exhaustive. This query gives more constraints that may be candidates for this sort of simplification.
  2. This item-requires-statement constraint has 39 values of "item of property constraint", which are meant to include all filmmaking occupations, but are likely not exhaustive. Instead, these entries could be replaced with class (P2308) = filmmaking occupation (Q4220920), relation (P2309) = instance of (Q21503252), which would be exhaustive. This query gives more such constraints.
  3. This conflicts-with constraint has 27 values of "item of property constraint", which are meant to include all types of crime, but are likely not exhaustive. Instead, these could all be replaced with class (P2308) = crime (Q83267), relation (P2309) = subclass of (Q21514624), which would be exhaustive. This query gives more such constraints.
  4. (new constraint): The value of instance of (P31) should not be a taxon (Q16521). (If the item is an individual organism (Q110224119), it should use individual of taxon (P10241); if the item is a taxon, it should use parent taxon (P171).) As of writing, 18,080 items violated this rule: (query). Obviously, we can't list all taxons in a constraint. Under the proposal, this rule could be expressed with a none-of constraint on instance of (P31), with class (P2308) = taxon (Q16521) and relation (P2309) = instance of (Q21503252).
Assigned focus area

Unassigned

Type of wish
Feature request
Tags
Affected users

Wikidata users and editors

Phabricator tasks
Other details
  • Created: 18:32, 15 July 2024
  • Last updated: 15:41, 3 October 2025
  • Author: Swpb (talk)
Voting

This wish currently has 4 supporters. Voting for this wish is open until it is completed.

Supporters of this wish
Support Swpb (talk) 18:32, 15 July 2024
Support Pppery (talk) 16:52, 10 October 2025
Support Jmabel (talk) 07:02, 5 December 2025
Support JAn Dudík (talk) 15:15, 31 January 2026