Property talk:P2302
Documentation
constraint applicable to a Wikidata property
List of violations of this constraint: Database reports/Constraint violations/P2302#allowed qualifiers, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P2302#Item P2302, search, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P2302#Item P2302, search, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P2302#Multi value, SPARQL
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
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
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
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
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"
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
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
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
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 constraint | P2302 | Item | property constraint: constraint applicable to a Wikidata property | IMDb ID <property constraint> distinct-values constraint | - |
exception to constraint | P2303 | Item | item that is an exception to the constraint, qualifier to define a property constraint in combination with P2302 | IUCN conservation status <exception to constraint> Varia jamoerensis | - |
group by | P2304 | Property | GROUP BY: qualifier to define a property constraint in combination with P2302 (Wikidata property constraint) that is used to group constraint violations in constraint violation reports | → Property talk:P2304 | - |
item of property constraint | P2305 | Item | allowed-entity-types constraint: qualifier to define a property constraint in combination with "property constraint" (P2302) | mass <item of property constraint> kilogram | - |
property | P2306 | Property | Wikidata 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 namespace | P2307 | String | qualifier used with the Commons link property constraint (Q21510852) to specify acceptable Wikimedia Commons namespaces that a property value can link to | → Property talk:P2307 | - |
class | P2308 | Item | class: qualifier to define a property constraint in combination with "property constraint" (P2302) | → Property talk:P2308 | - |
relation | P2309 | Item | relation 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 this | → Property talk:P2309 | - |
minimum date (property constraint) | P2310 | Point in time | qualifier to define a property constraint in combination with "property constraint" (P2302) | → Property talk:P2310 | - |
maximum date (property constraint) | P2311 | Point in time | qualifier to define a property constraint in combination with "property constraint" (P2302). Use "unknown value" for current date. | → Property talk:P2311 | - |
maximum value | P2312 | Quantity | maximum: qualifier to define a property constraint in combination with P2302. "no value" can be used to specify no upper bound | range constraint <maximum value> 1,234 | - |
minimum value | P2313 | Quantity | minimum: qualifier to define a property constraint in combination with P2302 | range constraint <minimum value> 0 | - |
format as a regular expression | P1793 | String | regular expression: regex describing an identifier or a Wikidata property. When using on property constraints, ensure syntax is a PCRE | ISO 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 status | P2316 | Item | Wikidata 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 clarification | P2916 | Monolingual text | syntax: 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)
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
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)
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 property (P1696) edit
Another one.
Current
New:
- part of (P361) > property constraint (P2302) > inverse constraint (Q21510855) > property (P2306) > has part(s) (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 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)
- 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. 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://phabricator.wikimedia.org/T118232 might be a problem for the qualifier approach. --- Jura 13:14, 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. 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)
- 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)
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)
- @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)
- @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)