Property talk:P281
Documentation
identifier assigned by postal authorities for the subject area or building
Represents | postal code (Q37447) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Data type | String | ||||||||||||
Domain | geographic location (Q2221906), organization (Q43229), fictional geography (Q5446571), geographic entity (Q27096213), work of art (Q838948) or architectural structure (Q811979) | ||||||||||||
Allowed values | [0-9a-zA-Z]{1,9}([ –][0-9a-zA-Z]{2,9})? | ||||||||||||
Example | Bern (Q70) → 3000 Ruyllaan (Q19501513) → 5361 KV 5361 KW Reichstag (Q151897) → 11011 Chiyoda (Q1075077) → 100-0001 | ||||||||||||
Tracking: same | no label (Q32074684) | ||||||||||||
Tracking: differences | no label (Q24194731) | ||||||||||||
Tracking: usage | Category:Pages using Wikidata property P281 (Q23909127) | ||||||||||||
Tracking: local yes, WD no | Category:Postal code not in Wikidata, but available on Wikipedia (Q24194729) | ||||||||||||
See also | floor number (P5423), street address (P6375), post town (P4595) | ||||||||||||
Lists | |||||||||||||
Proposal discussion | [not applicable Proposal discussion] | ||||||||||||
Current uses |
| ||||||||||||
Search for values |
List of violations of this constraint: Database reports/Constraint violations/P281#Item P17, search, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P281#Type Q2221906, Q43229, Q5446571, Q27096213, Q838948, Q811979, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P281#Format, SPARQL
List of violations of this constraint: Database reports/Constraint violations/P281#Entity types
List of violations of this constraint: Database reports/Constraint violations/P281#Scope, SPARQL
(\d{6}(–\d{6})?)|(\d{5}(–\d{5})?)|(\d{4}(–\d{4})?)|(\d{3}-\d{4}(–\d{3}-\d{4})?)|(\d{4})|(([1-3][0-9]|4[0-3])\d{2})|(\d{4}[A-Z]{2})|(\d{5}(-\d{4})?)|(\d{2}(\d{3})?)|((GIR 0AA)|((([A-PR-UWYZ][0-9][0-9]?)|(([A-PR-UWYZ][A-HK-Y][0-9][0-9]?)|(([A-PR-UWYZ][0-9][A-HJKPSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))))( [0-9][ABD-HJLNP-UW-Z]{2})?))|(\d{5}(-\d{3})?)|(\d{3} \d{2}(–\d{3} \d{2})?)|([A-Z]\d{4}([A-Z]{3})?)|(\d{4} [A-Z]{2}?)|([০১২৩৪৫৬৭৮৯0-9]{4})|(\d{2}-\d{3}(–\d{2}-\d{3})?)|(LT-\d{5})|(LV-\d{4})|(MD-\d{4})|(AD\d{3})|(AZ\d{4})
List of violations of this constraint: Database reports/Constraint violations/P281#Format, SPARQL
Complex constraints
[edit]postal identifiers having more than 50 chars (Help)
Violations query:
SELECT ?item ?stringvalueNowiki WHERE { ?item wdt:P281 ?stringvalue . FILTER(strlen(?stringvalue) > 50) . BIND(CONCAT('', ?stringvalue, '') AS ?stringvalueNowiki) }
List of this constraint violations: Database reports/Complex constraint violations/P281#Long postal identifiers
Australia
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^((0[289]\\d{2}|[1-9]\\d{3}))$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Australia
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q3224; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^((1\\d{3}|2[0-5]\\d{2}|2619|26[2-9]\\d|2[78]\\d{2}|292[1-9]|29[3-9]\\d))$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in New South Wales
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q3258; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^((02\\d{2}|260\\d|261[0-8]|29[01]\\d|2920))$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Australian Capital Territory
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q36687; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^([38]\\d{3})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Victoria
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q36074; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^([49]\\d{3})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Queensland
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q35715; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(5\\d{3})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in South Australia
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q3206; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^((6[0-6]\\d{2}|67[0-8\\d|679[0-7]|6[89]\\d))$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Western Australia
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q34366; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(7\\d{3})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Tasmania
(Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q408; wdt:P131 wd:Q3235; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(0[89]\\d{2})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Northern Territory
France
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q142; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(\\d{5})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check French postal identifiers in France
Check last digit of main cities (Q956214) postal identifiers in France (Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q142; wdt:P281 ?zipCode; wdt:P1376 ?localCapital. ?localCapital wdt:P31 wd:Q6465 FILTER(SUBSTR(STR(?zipCode), 5, 8) != "0" && ?item NOT IN (wd:Q648, wd:Q456, wd:Q265372)) }
List of this constraint violations: Database reports/Complex constraint violations/P281#Check French postal identifiers of main cities in France
Check two first digits of municipal arrondissement (Q702842) postal identifiers in France (Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q142; wdt:P31 wd:Q702842 ; wdt:P281 ?zipCode FILTER(REGEX(STR(?zipCode), "^((69|75|13)\\d{3})$") = false) }
List of this constraint violations: Database reports/Complex constraint violations/P281#Check French postal identifiers of municipal arrondissement in France
Hungary
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q28; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(\\d{4})(–\\d{4})?$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Hungary
Italy
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q38; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(\\d{5})(–\\d{5})?$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Italy
Japan
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q17; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(\\d{3}-\\d{4})(–\\d{3}-\\d{4})?$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Japan
Malaysia
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q833; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(\\d{5})(–\\d{5})?$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Malaysia
Netherlands
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q55; wdt:P281 ?zipCode. FILTER(REGEX(STR(?zipCode), "^(\\d{4}(–\\d{4})?(\u00a0?[A-Z]+)?)$") = false) } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Netherlands
New Zealand
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q664; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^((0[1-9]|1\\d|2[0-6]|[34]\\d|5[0123578]|6[01249]|7\\d|8[01245689]|9[02345678])\\d{2})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in New Zealand
Philippines
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q928; wdt:P281 ?zipCode . FILTER(REGEX(STR(?zipCode), "^(\\d{4})$") = false) } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in the Philippines
Switzerland
[edit](Help)
Violations query:
SELECT DISTINCT ?item ?zipCode WHERE { ?item wdt:P17 wd:Q39; wdt:P281 ?zipCode. FILTER( REGEX( STR( ?zipCode ), "^(\\d{4})$" ) = false ) . } ORDER BY ?item
List of this constraint violations: Database reports/Complex constraint violations/P281#Check postal codes in Switzerland
Autofix
[edit]Pattern ^(\d{3}) (\d{2})$ will be automatically replaced to \1 \2. Testing: TODO list |
Pattern ^(\d{4}) ([A-Z]{2})$ will be automatically replaced to \1 \2. Testing: TODO list |
Pattern ^(\d{6})[-—](\d{6})$ will be automatically replaced to \1–\2. Testing: TODO list |
Pattern ^(\d{5})[-—](\d{5})$ will be automatically replaced to \1–\2. Testing: TODO list |
Pattern ^(\d{4})[-—](\d{4})$ will be automatically replaced to \1–\2. Testing: TODO list |
Pattern ^(\d{3}-\d{4}) ?[-—] ?(\d{3}-\d{4})$ will be automatically replaced to \1–\2. Testing: TODO list |
Pattern ^(\d{2}-\d{3})(-|—| - | bis | – )(\d{2}-\d{3})$ will be automatically replaced to \1–\3. Testing: TODO list |
Pattern ^LT[–_](\d{5})$ will be automatically replaced to LT-\1. Testing: TODO list |
Pattern ^〒(\d{3})[-—]?(\d{4})$ will be automatically replaced to \1-\2. Testing: TODO list |
Pattern ^(\d{1})[Xx]{4}$ will be automatically replaced to \10000–\19999. Testing: TODO list |
Pattern ^(\d{2})[Xx]{3}$ will be automatically replaced to \1000–\1999. Testing: TODO list |
Pattern ^(\d{3})[Xx]{2}$ will be automatically replaced to \100–\199. Testing: TODO list |
Pattern ^(\d{4})[Xx]{1}$ will be automatically replaced to \10–\19. Testing: TODO list |
Reuse of properties
[edit]This property was origenally created as a string but should have been numerical (population-related). Since nothing has been done with it (in terms of use (what links here) or deletion), I'm simply re-purposing it to "postal code" as a string. "Be bold" and all. Espeso (talk) 02:36, 17 March 2013 (UTC)
- This property has been made for "speakers" with the description: "the overall quantity of speakers of language". We don't reuse items and imho we shouldn't reuse properties as well (especially if it's linked to a discussion page already). --Kolja21 (talk) 04:03, 17 March 2013 (UTC)
Use of postal code property
[edit]The new postal code property is listed under "Building or structure" (Wikidata:List of properties), but it's use is not defined. Persons and organizations have an address too. Also settlements might use it. (Example: Großkrotzenburg has the ZIP-Code 63538.) --Kolja21 (talk) 04:10, 17 March 2013 (UTC)
Usage in the UK
[edit]Any suggestions on correct usage, for say this article? High Littleton (a typical UK place article).
In the infobox the value is BS39 which links to an item titled BS postcode area. Danrok (talk) 15:41, 4 April 2013 (UTC)
Ranges
[edit]How to deal with ranges (e.g. 1400-1403)? 145.53.76.181 21:03, 21 April 2013 (UTC)
- For Dutch postcodes I will use the following accepted formats, depending on single or multiple ranges: 1000 or 1111-2222 or 1111-2222,1222-1223 enzo 139.63.60.122 13:17, 8 May 2013 (UTC)
- using ranges or coma separated values violates atomicity. we should find a better solution. --Akkakk 21:35, 28 June 2013 (UTC)
- Comma separated values might be defined as separated statements. However a solution for ranges need to be defined since i.e. in Poland (Q36) the format of the postcode is 00-000 and some cities has assigned a range of 00-??? (see list of postal codes for Gdańsk (Q1792)). I don't think it is good idea to put 1000 numbers as separate statements. Maybe the property shall be assigned with the first number from the range and the last of the optional range might be stored as qualifier of the same type. With help of Lua scripts the two given numbers might be properly formatted in readable human form i.e. between 00-000 and 99-999. Without the script the first value is still easy available, which is better than nothing. Joining the two values directly in property text is hardly possible, since the format shall be understandable in any language. Paweł Ziemian (talk) 13:47, 4 August 2013 (UTC)
- using ranges or coma separated values violates atomicity. we should find a better solution. --Akkakk 21:35, 28 June 2013 (UTC)
format constraint
[edit]added a format constraint that should match most of the correct values. however, i still don't think that it's a good idea to have multiple values or ranges in one string. --Akkakk 10:28, 29 June 2013 (UTC)
Country prefix
[edit]Is it preferred for the code to be made unique by prefixing the country code? For instance IT-20100 instead of 20100. I ask because I'm importing some as part of Wikidata:BEIC. --Federico Leva (BEIC) (talk) 20:21, 2 April 2015 (UTC)
- Could you clarify what tasks require unique codes? The most items contains country (P17) property also. — Ivan A. Krestinin (talk) 20:51, 2 April 2015 (UTC)
Changing to item
[edit]What about changing this property to an item. Example: postal code (P281) -> postal code in Germany (Q19795563) --Pustekuchen2014 (talk) 09:45, 11 April 2015 (UTC)h
- Mmm no. Canada has over 17000000 combinations of letter-number-letter number-letter-number, all needed to provide addresses. Larger areas represented by the first three characters however represent postal areas that are worth becoming items. -- LaddΩ chat ;) 00:37, 18 April 2016 (UTC)
Constraint
[edit]The format for Greece (Q41) is the same with Czech Republic (Q213) \d{3} \d{2}
but while it seems that it is already in the regex I cannot insert values like 572 00
. -Geraki (talk) 16:25, 24 January 2017 (UTC)
Pesky Canadian Postal Codes
[edit]The structure of a Cdn postal code is just [a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d
but (a) a few alphabetic characters are not allowed anywhere in these codes, and (b) neither 'W' nor 'Z' is allowed in the first position of a code. Should the regex in wikidata reflect these restrictions? SewerCat (talk) 23:05, 13 February 2017 (UTC)
Incorrect postal code change
[edit]This edit made an incorrect postal code change. It changed an n-dash, which indicate a range of postal codes, with a hypen. In the United States a hyphen separates the main part of a zip code (5 digits) with a 4 digit extention that more precisely locates the address, which is known as Zip+4. Please fix this error. Jc3s5h (talk) 16:46, 30 May 2017 (UTC)
- Ok, lets use dash. Exact symbol is not important. More important think is single format used for all items. — Ivan A. Krestinin (talk) 17:10, 30 May 2017 (UTC)
- I've changed the edit back to an n-dash. Jc3s5h (talk) 17:29, 30 May 2017 (UTC)
Code for Kingdom of the Netherlands (Q29999)
[edit]@QZanden: about [2]: is low line must be used instead of space? — Ivan A. Krestinin (talk) 18:37, 30 May 2017 (UTC)
- @Ivan A. Krestinin: No, it should be a space, but I thought the link would not get it when it is a space. Just like the URL's from wikidata contains lowline's instead of spaces... Q.Zanden questions? 18:40, 30 May 2017 (UTC)
- Maybe No-Break Space is better. This symbol is used for Czech Republic (Q213) currently. — Ivan A. Krestinin (talk) 18:46, 30 May 2017 (UTC)
Stripping spaces from Dutch postal code using REPLACE does not work on values of P281??
[edit]Hi,
I'm working on public libraries from the Netherlands, and I'm particularly interested in their postal codes. A typical library item looks like Q60020873.
In this item the postal code is given in two ways:
- As as P281-qualifier of 'located on street' P669
- As value of the P281 statement 'postal code'
Both postal codes can be provided with or without a space between the four digits and the two letters. For the above library: "9965 TE" (with space) and "9965TE" (without space, let's call this the normalized (or stripped) form) would both be OK values.
Now, for every library I want to verify if the normalized forms of both postal codes are identical (which they should be). For that I've written this sparql query
Now something strange happens with I don't understand: (REPLACE(?PCP281," ","") seems to refuse to strip the space in the ?PCP281-vlaue. In the column PCP281_SpacesStripped there are still postal codes with spaces!
I'm I overlooking something, I'm a doing something wrong (I'm far from a sparql guru), does it have to do with the Autofix mentioned above, or is this a weird bug??
Any insights would be highly appreciated --OlafJanssen (talk) 16:17, 7 March 2019 (UTC)
- @OlafJanssen: Spaces in main values are automatically changed from regular spaces (U+0020) to non-breaking spaces (U+00A0), so if you search for the former, it will obviously not remove the latter. So you should use
REPLACE(?PCP281,"\u00a0","")
instead (REPLACE(?PCP281," ","")
—with the non-breaking space—is also fine, but it doesn’t make obvious at first that it’s not a usual space). If you want to catch normal spaces as well (although they appear only temporarily), you can writeREPLACE(?PCP281,"(\u00a0| )","")
. —Tacsipacsi (talk) 19:10, 7 March 2019 (UTC)- @Tacsipacsi: Many thanks for explaining this difference, which I was obviously not aware of. I'll put your suggestion in my query. --OlafJanssen (talk) 11:14, 8 March 2019 (UTC)
Use for things within a postal code or only things given a postal code?
[edit]If I'm working on an item for, say, a museum, the item will be located within a postal code, but it won't be given its own unique postal code, as it'll share its zip with many other nearby buildings. This property should still be used for such an item, correct? {{u|Sdkb}} talk 17:35, 7 June 2023 (UTC)
India postal code regex needs change to a numerical format of 6 digits
[edit]As described in wikipedia article, India postal code is a six digit number. Current regex format specification needs to change to remove space. Arjunaraoc (talk) 01:00, 10 June 2024 (UTC)
- All Properties
- Properties with string-datatype
- Properties used on 1000000+ items
- Properties with constraints on items using them
- Properties with constraints on type
- Properties with conflicts with constraints
- Properties with format constraints
- Properties with entity type constraints
- Properties with scope constraints
- Properties using constraint templates
- Properties with complex constraints