Property talk:P2302

Documentation

property constraint
constraint applicable to a Wikidata property
Representsproperty constraint (Q21502402)
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), required qualifier constraint (Q21510856), multi-value constraint (Q21510857), one-of constraint (Q21510859), range constraint (Q21510860), single-value constraint (Q19474404), symmetric constraint (Q21510862), subject 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), lexeme value requires lexical category constraint (Q64006792), label in language constraint (Q108139345) or description in language constraint (Q111204896)
Usage notesBoth Special:Constraint report and Wikidata:Database reports/Constraint violations use constraint statements, and have done so 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 property (P1696)
Lists
Proposal discussionProposal discussion
Current uses
Total77,300
Main statement77,269>99.9% of uses
Qualifier24<0.1% of uses
Reference7<0.1% of uses
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), Wikimedia Commons namespace (P2307), class (P2308), relation (P2309), minimum date (property constraint) (P2310), maximum date (property constraint) (P2311), maximum value (P2312), minimum value (P2313), constraint status (P2316), format as a regular expression (P1793), syntax clarification (P2916), separator (P4155), constraint scope (P4680), property scope (P5314), constraint clarification (P6607), replacement property (P6824), reason for deprecated rank (P2241), reason for preferred rank (P7452), regular expression syntax (P4240), replacement value (P9729), maintained by WikiProject (P6104), Wikimedia language code (P424): this property should be used only with the listed qualifiers. (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P2302#allowed qualifiers, SPARQL
Type “Wikidata property (Q18616576): item must contain property “instance of (P31)” with classes “Wikidata property (Q18616576)” or their subclasses (defined using subclass of (P279)). (Help)
List of violations of this constraint: Database reports/Constraint violations/P2302#Type Q18616576, hourly updated report, SPARQL
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 violations of this constraint: Database reports/Constraint violations/P2302#Value type Q21502402, hourly updated report, SPARQL
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), required qualifier constraint (Q21510856), multi-value constraint (Q21510857), one-of constraint (Q21510859), range constraint (Q21510860), single-value constraint (Q19474404), symmetric constraint (Q21510862), subject 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), lexeme value requires lexical category constraint (Q64006792), label in language constraint (Q108139345), description in language constraint (Q111204896): value must be one of the specified items. Please expand list if needed. (Help)
List of violations of this constraint: Database reports/Constraint violations/P2302#One of, values statistics, hourly updated report, SPARQL
Scope is as main value (Q54828448): the property must be used by specified way only (Help)
List of violations of this constraint: Database reports/Constraint violations/P2302#Scope, hourly updated report, SPARQL
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)
List of violations of this constraint: Database reports/Constraint violations/P2302#Target required claim P18, hourly updated report, SPARQL, SPARQL (by value)
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)
List of violations of this constraint: Database reports/Constraint violations/P2302#Target required claim P1813, hourly updated report, SPARQL, SPARQL (by value)
Allowed entity types are Wikibase property (Q29934218): the property may only be used on a certain entity type (Help)
List of violations of this constraint: Database reports/Constraint violations/P2302#Entity types, hourly updated report
Multi value: this property generally contains two or more values. (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P2302#Multi value, SPARQL
Item “property proposal discussion (P3254): Items with this property should also have “property proposal discussion (P3254)”. (Help)
List of violations of this constraint: Database reports/Constraint violations/P2302#Item P3254, hourly updated report, SPARQL
 
"allowed units constraint", "integer constraint" and "no-bounds constraint" must only be used on properties with a Quantity datatype
Only properties with a quantity (Q29934271) datatype should have allowed units constraint (Q21514353), integer constraint (Q52848401) and no-bounds constraint (Q51723761) applied. (Help)
Violations query: SELECT ?item ?itemLabel ?datatype WHERE { VALUES ?constraints { wd:Q21514353 wd:Q52848401 wd:Q51723761 }. ?item wdt:P2302 ?constraints. ?item wikibase:propertyType ?datatype. FILTER (?datatype != wikibase:Quantity). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#"allowed units constraint", "integer constraint" and "no-bounds constraint" must only be used on properties with a Quantity datatype
 
"Commons link constraint" must only be used on properties with a CommonsMedia, GeoShape, TabularData or String datatype
Only properties with a CommonsMedia (Q29934260), GeoShape (Q42742911), TabularData (Q42743260) or Wikibase string datatype (Q29934246) datatype should have Commons link constraint (Q21510852) applied. (Help)
Violations query: SELECT ?item ?itemLabel ?datatype WHERE { VALUES ?constraints { wd:Q21510852 }. ?item wdt:P2302 ?constraints. ?item wikibase:propertyType ?datatype. FILTER (?datatype NOT IN (wikibase:CommonsMedia, wikibase:GeoShape, wikibase:TabularData, wikibase:String)). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#"Commons link constraint" must only be used on properties with a CommonsMedia, GeoShape, TabularData or String datatype
 
"contemporary constraint" must only be used on properties with an Item datatype
Only properties with an Wikibase item (Q29934200) datatype should have contemporary constraint (Q25796498) applied. (Help)
Violations query: SELECT ?item ?itemLabel ?datatype WHERE { VALUES ?constraints { wd:Q25796498 }. ?item wdt:P2302 ?constraints. ?item wikibase:propertyType ?datatype. FILTER (?datatype != wikibase:WikibaseItem). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#"contemporary constraint" must only be used on properties with an Item datatype
 
"value-type constraint" must only be used on properties with an Item, Property or Lexeme datatype
Only properties with an Wikibase item (Q29934200), Wikibase property (Q29934218) or Wikibase lexeme (Q51885771) datatype should have value-type constraint (Q21510865) applied. (Help)
Violations query: SELECT ?item ?itemLabel ?datatype WHERE { VALUES ?constraints { wd:Q21510865 }. ?item wdt:P2302 ?constraints. ?item wikibase:propertyType ?datatype. FILTER (?datatype NOT IN (wikibase:WikibaseItem, wikibase:WikibaseProperty, wikibase:WikibaseLexeme)). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#"value-type constraint" must only be used on properties with an Item, Property or Lexeme datatype
 
"allowed qualifiers constraint" and "required qualifiers constraint" must only be used on properties that have a scope of "as main value"
Properties with a property constraint (P2302) value of either allowed qualifiers constraint (Q21510851) or required qualifier constraint (Q21510856) must also have a property constraint (P2302) value of property scope constraint (Q53869507) with qualifier property scope (P5314) having the value as main value (Q54828448). (Help)
Violations query: SELECT ?item ?itemLabel ?constraint ?constraintLabel WHERE { VALUES ?constraint { wd:Q21510851 wd:Q21510856 }. ?item wdt:P2302 ?constraint. FILTER NOT EXISTS { ?item p:P2302 [ ps:P2302 wd:Q53869507; pq:P5314 wd:Q54828448 ]. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#"allowed qualifiers constraint" and "required qualifiers constraint" must only be used on properties that have a scope of "as main value"
 
"one-of constraint" and "none-of constraint" are incompatible
If one-of constraint (Q21510859) is defined as a constraint, then none-of constraint (Q52558054) must not be defined. (Help)
Violations query: SELECT ?item ?itemLabel WHERE { ?item wdt:P2302 wd:Q21510859. ?item wdt:P2302 wd:Q52558054. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#"one-of constraint" and "none-of constraint" are incompatible
 
"single-value constraint", "single-best-value constraint" and "multi-value constraint" are incompatible
Only one of the following constraints must be defined for a property: single-value constraint (Q19474404), single-best-value constraint (Q52060874) or multi-value constraint (Q21510857). (Help)
Violations query: SELECT ?item ?itemLabel WHERE { { SELECT ?item (COUNT(?item) AS ?count) WHERE { VALUES ?constraints { wd:Q19474404 wd:Q52060874 wd:Q21510857 } ?item wdt:P2302 ?constraints } GROUP BY ?item } FILTER (?count > 1). SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#"single-value constraint", "single-best-value constraint" and "multi-value constraint" are incompatible
 
Preferred values are forbidden
Due to nature of constraints, making any specific constraint as preferred makes no sense and breaks tools that use wdt:P2302 in SPARQL queries. (Help)
Violations query: SELECT ?item { ?item a wikibase:Property . FILTER EXISTS{?item p:P2302 [wikibase:rank ?rank] FILTER(?rank = wikibase:PreferredRank)} }
List of this constraint violations: Database reports/Complex constraint violations/P2302#Preferred values are forbidden
 
Constraint fully disallows usage of property
Incorrectly filled "property scope" and "allowed-entity-types" constraints will mark all usage of statement as violation (Help)
Violations query: SELECT ?item ?st { { # property scope constraint without any valid property scope qualifier ?item a wikibase:Property ; p:P2302 ?st . ?st ps:P2302 wd:Q53869507 . FILTER NOT EXISTS {VALUES ?scope {wd:Q54828448 wd:Q54828449 wd:Q54828450} . ?st pq:P5314 ?scope } . } UNION { # allowed-entity-types constraint without any valid entity type ?item a wikibase:Property ; p:P2302 ?st . ?st ps:P2302 wd:Q52004125 . FILTER NOT EXISTS {VALUES ?scope {wd:Q29934200 wd:Q29934218 wd:Q51885771 wd:Q54285143 wd:Q54285715 wd:Q59712033} . ?st pq:P2305 ?scope } . } }
List of this constraint violations: Database reports/Complex constraint violations/P2302#Constraint fully disallows usage of property
Title ID Data type Description Examples Inverse
property constraintP2302Itemproperty constraint: constraint applicable to a 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 P2302IUCN conservation status <exception to constraint> Varia jamoerensis-
group byP2304PropertyGROUP BY: qualifier to define a property constraint in combination with P2302 (Wikidata property constraint) that is used to group constraint violations in constraint violation reportsProperty talk:P2304-
item of property constraintP2305Itemallowed-entity-types constraint: qualifier to define a property constraint in combination with "property constraint" (P2302)mass <item of property constraint> kilogram-
propertyP2306PropertyWikidata property: qualifier to define a property constraint in combination with P2302 (property constraint), or to limit the scope of Q44292881 (wikidata statement)Property talk:P2306-
Wikimedia Commons namespaceP2307Stringqualifier used with the Commons link property constraint (Q21510852) to specify acceptable Wikimedia Commons namespaces that a property value can link toProperty talk:P2307-
classP2308Itemclass: qualifier to define a property constraint in combination with "property constraint" (P2302)Property talk:P2308-
relationP2309Itemrelation and relation: qualifier 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 "type of kinship" (P1039), not thisProperty talk:P2309-
minimum date (property constraint)P2310Point in timequalifier to define a property constraint in combination with "property constraint" (P2302)Property talk:P2310-
maximum date (property constraint)P2311Point in timequalifier to define a property constraint in combination with "property constraint" (P2302). Use "unknown value" for current date.Property talk:P2311-
maximum valueP2312Quantitymaximum: qualifier to define a property constraint in combination with P2302. "no value" can be used to specify no upper boundrange constraint <maximum value> 1,234-
minimum valueP2313Quantityminimum: qualifier to define a property constraint in combination with P2302range constraint <minimum value> 0-
format as a regular expressionP1793Stringregular expression: regex describing an identifier or a Wikidata property. When using on property constraints, ensure syntax is a PCREISO 639-3 <format as a regular expression> [a-z]{3} and IMDb ID <format as a regular expression> ev\d{7}\/\d{4}(-\d)?|(ch|co|ev|nm|tt)\d{7}-
constraint statusP2316ItemWikidata constraint status: qualifier to define a property constraint in combination with P2302. Use values "mandatory constraint" or "suggestion constraint"property scope constraint <constraint status> mandatory constraint-
syntax clarificationP2916Monolingual textsyntax: qualifier for P1793 (regular expression): to provide a textual description of the regex syntax of a value. Should be displayable after the text "The value for the property should match" and be followed by the regex.Yandex Music artist ID <syntax clarification> numerisk streng, 1 til 7 tall-

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)Reply

  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)Reply

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

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

Other edit

There is also:

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


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) > required qualifier constraint (Q21510856) > property (P2306) > start time (P580)

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


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)Reply

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 property (P1696) edit

Another one.

Current

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

New:

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

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


P2237 (P2237) edit

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


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 quantum number (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 catalog ID (P2264): {{Constraint:Single value|exceptions={{P|350}} }}

3. 'now' value and range constraint:

year of publication of scientific name for taxon (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)Reply


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)Reply
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)Reply
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)Reply
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)Reply
5. https://www.wikidata.org/wiki/Special:EntityData/P370.rdf is a bit slow. --- Jura 13:26, 23 November 2015 (UTC)Reply
5. https://phabricator.wikimedia.org/T118232 might be a problem for the qualifier approach. --- Jura 13:14, 23 November 2015 (UTC)Reply
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)Reply
1. Property talk:P1632#Formatting seems to be a problem in any case. --- Jura 10:22, 24 November 2015 (UTC)Reply
1. Sample for a quantity-property that could be limited to three decimals: Property talk:P1081. --- Jura 12:41, 24 November 2015 (UTC)Reply

Defining where to find suggestions for data in a page edit

For web-based databases (that by their nature have strictly formatted pages), could there be a way to define with regex (or whatever) where to find a given piece of information within a webpage (like is done with URL's using "URL match pattern")

The idea being that, for example, we could define that for a page from https://www.ibdb.com/broadway-production/ (https://www.wikidata.org/wiki/Property:P1218) the name of the show within the page will have the class title-label, this would mean when looking at https://www.ibdb.com/broadway-production/dear-evan-hansen-508238 it would know to suggest name of the show is "Dear Evan Hansen"

Back ache (talk) 08:11, 27 September 2021 (UTC)Reply

@Back ache: If all dataset is viewable from a single page, you can set search formatter URL (P4354) to build links like https://www.ibdb.com/shows#:~:text=Dear%20Evan%20Hansen (a. k. a. text fragments). But even for your example it won't work, because the main page contains only small subset of items. --Lockal (talk) 09:22, 29 September 2021 (UTC)Reply
@Lockal: I like the idea of using web snippets and will experiment with it, I thought what search formatter URL (P4354) was for was just defining the url for the search-engine of a given site, perhaps the web snippet idea would be better used in formatter URL (P1630) as it results in an outbound URLsomething like https://www.ibdb.com/broadway-production/dear-evan-hansen-508238#title-label:~:text=Dear%20Evan%20Hansen
I was meaning with my original example though was to enable better web-scraping from pages *into* wikidata, so that within a subject type constraint (Q21503250) for a given relation (P2309) as well as the suggestion from class (P2308) you add a piece of regex to show where to get it from within the text, in my example that would be ‹h3 class="title-label"›(.*?)‹/h3›
Back ache (talk)
Return to "P2302" page.