Property talk:P2302

From Wikidata
Jump to navigation Jump to search

Documentation

property constraint
constraint applicable to this Wikidata property
Representsproperty constraint (Q21502402)
Associated item
Data typeItem
DomainWikidata property (Q18616576)
Allowed valuesallowed qualifiers constraint (Q21510851), allowed units constraint (Q21514353), Commons link constraint (Q21510852), conflicts-with constraint (Q21502838), contemporary constraint (Q25796498), difference within range constraint (Q21510854), distinct values constraint (Q21502410), format constraint (Q21502404), inverse constraint (Q21510855), item requires statement constraint (Q21503247), mandatory qualifier constraint (Q21510856), multi-value constraint (Q21510857), one-of constraint (Q21510859), range constraint (Q21510860), single value constraint (Q19474404), symmetric constraint (Q21510862), type constraint (Q21503250), value requires statement constraint (Q21510864), value type constraint (Q21510865), no bounds constraint (Q51723761), integer constraint (Q52848401), allowed entity types constraint (Q52004125), none of constraint (Q52558054), property scope constraint (Q53869507), single best value constraint (Q52060874), one-of qualifier value property constraint (Q52712340), lexeme requires language constraint (Q55819106), lexeme requires lexical category constraint (Q55819078) and citation needed constraint (Q54554025)
Usage notesBoth Special:Constraint report and Wikidata:Database reports/Constraint violations starts to use constraint statements since July 2017
ExampleIMDb ID (P345)distinct values constraint (Q21502410)
date of birth (P569)single value constraint (Q19474404)
Robot and gadget jobsMigrate constraints from property talk pages.
See alsoinverse of (P1696)
Lists
Proposal discussionProperty proposal/Archive/40#P2302
Current uses5,513
Search for values
[create] Create a translatable help page (preferably in English) for this property to be included here
Qualifiers “exception to constraint (P2303), group by (P2304), item of property constraint (P2305), property (P2306), namespace (P2307), class (P2308), relation (P2309), minimum date (property constraint) (P2310), maximum date (property constraint) (P2311), maximum value (P2312), minimum quantity (property constraint) (P2313), constraint status (P2316), format as a regular expression (P1793), syntax clarification (P2916), separator (P4155), constraint scope (P4680), property scope (P5314): this property should be used only with the listed qualifiers. (Help)
Exceptions are possible as rare values may exist.
List of this constraint violations: Database reports/Constraint violations/P2302#Allowed qualifiers, SPARQL, SPARQL (new)
Type “Wikidata property (Q18616576): element must contain property “instance of (P31)” with classes “Wikidata property (Q18616576)” or their subclasses (defined using subclass of (P279)). (Help)
List of this constraint violations: Database reports/Constraint violations/P2302#Type Q18616576, hourly updated report, SPARQL, SPARQL (new)
Value type “property constraint (Q21502402): This property should use items as value that contain property “subclass of (P279)”. On these, the value for subclass of (P279) should be an item that uses subclass of (P279) with value property constraint (Q21502402) (or a subclass thereof). (Help)
List of this constraint violations: Database reports/Constraint violations/P2302#Value type Q21502402, hourly updated report, SPARQL, SPARQL (new)
One of allowed qualifiers constraint (Q21510851), allowed units constraint (Q21514353), Commons link constraint (Q21510852), conflicts-with constraint (Q21502838), contemporary constraint (Q25796498), difference within range constraint (Q21510854), distinct values constraint (Q21502410), format constraint (Q21502404), inverse constraint (Q21510855), item requires statement constraint (Q21503247), mandatory qualifier constraint (Q21510856), multi-value constraint (Q21510857), one-of constraint (Q21510859), range constraint (Q21510860), single value constraint (Q19474404), symmetric constraint (Q21510862), type constraint (Q21503250), value requires statement constraint (Q21510864), value type constraint (Q21510865), no bounds constraint (Q51723761), integer constraint (Q52848401), allowed entity types constraint (Q52004125), none of constraint (Q52558054), property scope constraint (Q53869507), single best value constraint (Q52060874), one-of qualifier value property constraint (Q52712340), lexeme requires language constraint (Q55819106), lexeme requires lexical category constraint (Q55819078), citation needed constraint (Q54554025): value must be one of the specified items. Please expand list if needed. (Help)
List of this constraint violations: Database reports/Constraint violations/P2302#One of, values statistics, hourly updated report, SPARQL, SPARQL (new)
Scope is: the property must be used by specified way only (Help)
List of this constraint violations: Database reports/Constraint violations/P2302#scope, hourly updated report, SPARQL (new)
Property “image (P18)” declared by target items of “property constraint (P2302): If [item A] has this property with value [item B], [item B] is required to have property “image (P18)”. (Help)
Exceptions are possible as rare values may exist.
List of this constraint violations: Database reports/Constraint violations/P2302#Target required claim P18, SPARQL, SPARQL (by value), SPARQL (new)
Property “short name (P1813)” declared by target items of “property constraint (P2302): If [item A] has this property with value [item B], [item B] is required to have property “short name (P1813)”. (Help)
Exceptions are possible as rare values may exist.
List of this constraint violations: Database reports/Constraint violations/P2302#Target required claim P1813, SPARQL, SPARQL (by value), SPARQL (new)
Allowed entity types are Wikibase property (Q29934218): the property may only be used on a certain entity type (Help)
List of this constraint violations: Database reports/Constraint violations/P2302#allowed entity types, hourly updated report, SPARQL (new)

Title
ID Data type Description Examples Inverse
property constraintP2302Itemproperty constraint: constraint applicable to this Wikidata propertyIMDb ID <property constraint> distinct values constraint-
exception to constraintP2303Itemitem that is an exception to the constraint, qualifier to define a property constraint in combination with P2302-
group byP2304PropertyGROUP BY: qualifier to define a property constraint in combination with P2302 (Wikidata property constraint)-
item of property constraintP2305Itemqualifier to define a property constraint in combination with P2302-
propertyP2306PropertyWikidata property: qualifier to define a property constraint in combination with P2302 (property constraint), or to limit the scope of Q44292881 (wikidata statement)-
namespaceP2307Stringqualifier to define a property constraint in combination with P2302 (Wikidata property constraint)-
classP2308Itemclass (set theory): qualifier to define a property constraint in combination with P2302-
relationP2309Itemqualifier to define a property constraint in combination with P2302. Possibly values are: "instance of", "subclass of" or "instance or subclass of". The qualifier to use with the property "relative" is "kinship type", not this.-
minimum date (property constraint)P2310Point in timequalifier to define a property constraint in combination with P2302-
maximum date (property constraint)P2311Point in timequalifier to define a property constraint in combination with P2302. Use "unknown value" for current date.-
maximum valueP2312Quantitymaximum: qualifier to define a property constraint in combination with P2302. "no value" can be used to specify no upper boundrange constraint-
minimum quantity (property constraint)P2313Quantityminimum: qualifier to define a property constraint in combination with P2302range constraint-
format as a regular expressionP1793Stringregular expression: regex describing an identifier or a Wikidata property. When using on property constraints, ensure syntax is compatible with PCRENTFS <format as a regular expression> [^\00/] and IMDb ID <format as a regular expression> ev\d{7}\/\d{4}(-\d)?|(ch|co|ev|nm|tt)\d{7}-
constraint statusP2316Itemqualifier to define a property constraint in combination with P2302-
syntax clarificationP2916Monolingual textsyntax: qualifier to provide extra details on the syntax of a statement value, in particular for P1793 (regular expression), qualifier to provide details on the function or purpose of a property constraint-

Label/description[edit]

As label and description seemed to have been made for a general list for Special:ConstraintReport, I adapted it a bit to the usual format. The same might need to be done with the others. --- Jura 10:02, 18 November 2015 (UTC)

✓ solved more or less.

Constraints currently not included in Special:ConstraintReport[edit]

New value for property: allowed units constraint (Q21514353)[edit]

This wasn't included in mw:WikidataQuality/Constraints, but as we have a corresponding template, I created this as well. --- Jura 19:31, 19 November 2015 (UTC)

Full list should eventually be available at Help:Property constraints/list of constraints. --- Jura 20:00, 19 November 2015 (UTC)

There is also P2237 (P2237) for the same. Not sure if that should be converted as well. --- Jura 20:07, 19 November 2015 (UTC)

Other[edit]

There is also:

--- Jura 12:09, 23 November 2015 (UTC)


Conversion of existing properties[edit]

Property:P1646[edit]

The above property should eventually be converted from

position held (P39) > P1646 (P1646) > start time (P580)

to:

position held (P39) > property constraint (P2302) > mandatory qualifier constraint (Q21510856) > property (P2306) > start time (P580)

(sample, possibly outdated, from property talk:P1646). --- Jura 19:31, 19 November 2015 (UTC)


format as a regular expression (P1793)[edit]

This is currently used directly on properties. Eventually this should be change to be used with property constraint (P2302). --- Jura 20:42, 19 November 2015 (UTC)

Current:

Wikimedia database name (P1800) > format as a regular expression (P1793) > "([a-z]{2,3}(_[a-z]*){0,2}|simple|wikidata|commons|species|meta|mediawiki)wiki(books|news|quote|source|voyage|)"

New:

Wikimedia database name (P1800) > property constraint (P2302) > format constraint (Q21502404) > format as a regular expression (P1793) > "([a-z]{2,3}(_[a-z]*){0,2}|simple|wikidata|commons|species|meta|mediawiki)wiki(books|news|quote|source|voyage|)"

inverse of (P1696)[edit]

Another one.

Current

part of (P361) > inverse of (P1696) > has part (P527)

New:

part of (P361) > property constraint (P2302) > inverse constraint (Q21510855) > property (P2306) > has part (P527)

--- Jura 22:42, 19 November 2015 (UTC)


P2237 (P2237)[edit]

See #New_value_for_property:_allowed_units_constraint_.28Q21514353.29--- Jura 12:09, 23 November 2015 (UTC)


New approach limitations[edit]

Incomplete TODO/to think list:

1. One of and quantity:

Mohs' hardness (P1088): {{Constraint:One of|values=1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}
parity (P1123): {{Constraint:One of|values=-1, 1}}
Hermann-Mauguin notation (P1632): {{Constraint:One of|values=1, {{overline|1}}, 2, m, 2/m, 222, mm2, mmm, 4, {{overline|4}}, 4/m, 422, 4mm, 42m, 4/mmm, 3, {{overline|3}}, 32, 3m, {{overline|3}}m, 6, {{overline|6}}, 6/m, 622, 6mm, 6m2, 6/mmm, 23, m3, 432, {{overline|4}}3m, m{{overline|3}}m}}

2. Properties in exceptions:

formatter URL (P1630): {{Constraint:Type|classes=Q19847637,Q18614948|relation=instance|exceptions={{P|625}}}} and other
mix'n'match catalogue ID (P2264): {{Constraint:Single value|exceptions={{P|350}} }}

3. 'now' value and range constraint:

year of taxon name publication (P574): {{Constraint:Range|min=1753|max=now|mandatory=true}}
retrieved (P813): {{Constraint:Range|min=2001|max=now}}
and other

4. How to copy-paste constraints?

5. Blocker issue: Wikidata editor hung on editing long lists. Real-life case: Property talk:P225, can be tested on Property:P370.

Ivan A. Krestinin (talk) 19:14, 22 November 2015 (UTC)


Some comments:
1. The new datatype for integers that is being discussed could be the better choice for Mohs' hardness (P1088). For indexes that do have a maximum number of decimals, a constraint for quantity could be helpful. Hermann-Mauguin notation (P1632) could be done with a regex. I wasn't aware that "one of" works for non-items, so we might need to change the module.
5. I tried an approach with Q21532100, see Property talk:P369
--- Jura 12:09, 23 November 2015 (UTC)
5. Several workarounds are possible, but its have negative points. For example your approach makes exception list querying too complex. Also exception list item will have the same issue with long list. — Ivan A. Krestinin (talk) 12:54, 23 November 2015 (UTC)
5. The problem with adding them to properties is that they are loaded every time we load the property. Given their length, maybe these lists should not be defined as exceptions, but handled through different definitions of the constraints. --- Jura 13:07, 23 November 2015 (UTC)
5. The page is loaded quickly, as I see. Main issue is editing. Editor can not process so long list. Exceptions is not the only long list. item of property constraint (P2305) will have many items for some properties too. — Ivan A. Krestinin (talk) 13:16, 23 November 2015 (UTC)
5. https://www.wikidata.org/wiki/Special:EntityData/P370.rdf is a bit slow. --- Jura 13:26, 23 November 2015 (UTC)
5. https://phabricator.wikimedia.org/T118232 might be a problem for the qualifier approach. --- Jura 13:14, 23 November 2015 (UTC)
6. +Wikidata:Property_proposal/Property_metadata#Constraint_report_mode. Currently Special:ConstraintReport doesn't apply constraints that are placed after a section heading. If the same should be possible in the new format, we need a property for this. --- Jura 09:33, 24 November 2015 (UTC)
1. Property talk:P1632#Formatting seems to be a problem in any case. --- Jura 10:22, 24 November 2015 (UTC)
1. Sample for a quantity-property that could be limited to three decimals: Property talk:P1081. --- Jura 12:41, 24 November 2015 (UTC)