Jump to content

Property talk:P281

Add topic
From Wikidata
Latest comment: 4 months ago by JensMueller in topic Any qualifiers for designating the postal system?

Documentation

postal code
code assigned by postal authorities for the subject area or building for the purpose of sorting and routing mail
Representspostal code (Q37447)
Data typeString
Domaingeographic location (Q2221906), organization (Q43229), fictional geography (Q5446571), geographic entity (Q27096213), work of art (Q838948) or built structure (Q811979)
Allowed values[0-9a-zA-Z]{1,9}([ –][0-9a-zA-Z]{2,9})?
ExampleBern (Q70) → 3000
Ruyllaan (Q19501513) → 5361 KV
5361 KW
Reichstag (Q151897) → 11011
Chiyoda (Q1075077) → 100-0001
Tracking: sameCategory:P281 same as Wikidata (Q32074684)
Tracking: differencesCategory:P281 different from Wikidata (Q24194731)
Tracking: usageCategory:Pages using Wikidata property P281 (Q23909127)
Tracking: local yes, WD noCategory:Postal code not in Wikidata, but available on Wikipedia (Q24194729)
See alsofloor number (P5423), street address (P6375), post town (P4595)
Lists
Proposal discussion[not applicable Proposal discussion]
Current uses
Total2,483,075
Main statement2,363,07595.2% of uses
Qualifier119,8354.8% of uses
Reference165<0.1% of uses
Search for values
[create Create a translatable help page (preferably in English) for this property to be included here]
Item “country (P17)”: Items with this property should also have “country (P17)”. (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/P281#Item P17, search, SPARQL
Conflicts with “instance of (P31): Wikimedia disambiguation page (Q4167410), human (Q5), taxon (Q16521), family name (Q101352), film (Q11424), river (Q4022)”: this property must not be used with the listed properties and values. (Help)
List of violations of this constraint: Database reports/Constraint violations/P281#Conflicts with P31, hourly updated report, search, SPARQL

constraint “conflicts-with constraint (Q21502838)” declaration error: “required qualifier “property (P2306)” is missing”.

Format “[^\]\|\[\(\)]{1,100}”: value must be formatted using this pattern (PCRE syntax). (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/P281#Format, SPARQL
Allowed entity types are Wikibase item (Q29934200): the property may only be used on a certain entity type (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/P281#Entity types
Scope is as main value (Q54828448), as qualifier (Q54828449): the property must be used by specified way only (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/P281#Scope, SPARQL
Format: value must be formatted using this pattern (PCRE syntax).
(\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})
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/P281#Format, SPARQL

Complex constraints

[edit]
Long postal identifiers
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]
Check postal codes in Australia
(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
Check postal codes in New South Wales
(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
Check postal codes in Australian Capital Territory
(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
Check postal codes in Victoria
(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
Check postal codes in Queensland
(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
Check postal codes in South Australia
(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
Check postal codes in Western 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
Check postal codes in Tasmania
(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
Check postal codes in Northern Territory
(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]
Check French postal identifiers in France
(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 French postal identifiers of main cities 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 French postal identifiers of municipal arrondissement 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]
Check postal codes in Hungary
(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]
Check postal codes in Italy
(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]
Check postal codes in Japan
(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]
Check postal codes in Malaysia
(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]
Check postal codes in Netherlands
(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]
Check postal codes in New Zealand
(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]
Check postal codes in the Philippines
(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]
Check postal codes in Switzerland
(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
Country Format Samples Notes
Russia (Q159) \d{6}(–\d{6})? 620000–620999 (Yekaterinburg (Q887))
188327 (Novokuznetsovo (Q53965))
The maximum and minimum areas covered by a single six-digit Russian postcode are:
  • Maximum Area: The largest area covered by a single set of postal codes is in the Sakha Republic (Yakutia), which uses postal codes in the 677xxx to 678xxx range and covers an enormous area of approximately 3.084 million square kilometers. This vast area has a very low population density.
  • Minimum Area: The smallest area covered by a single postcode is typically found within major cities like Moscow and Saint Petersburg, where a single postal code may apply to a single large building, a specific street segment, or even a PO box at a central post office. In some urban cases, the area covered might be just a few city blocks or a small cluster of properties, making the geographical area extremely small, potentially a few thousand square meters or less.

In general, Russian postcodes are designed to identify a specific post office that serves a defined delivery area, which can range from multiple cities/towns in sparsely populated regions to a small number of addresses in dense urban center

Belarus (Q184) The minimum area a postcode covers can be as small as:
  • A single property or a sub-section of a property (e.g., for a large organisation with high mail volume).
  • A specific section of a street or a few block radius in an urban area.

The maximum area for a single postcode can be:

  • An entire village or a large, sparsely populated rural region, including its associated local post office area.
  • A specific region within a large city, although large cities like Minsk are broken into many postcodes (Minsk alone has 141 districts/areas with distinct postcodes).

Therefore, it is impossible to specify a precise maximum and minimum "radius" in kilometres or miles, as the boundaries are based on administrative and delivery needs, not uniform geometric shapes.

Ukraine (Q212) \d{5}(–\d{5})? 93100-93199 (Lysychansk (Q33280))
92900 (Kreminna (Q2350295))
Germany (Q183) 10115–14199 (Berlin (Q64))
04613 (Lucka (Q285171))
Israel (Q801) 91000–91999 (Jerusalem (Q1218))
16706 (Kiryat Ata (Q152602))
Philippines (Q928) \d{4}(–\d{4})? 6560–6567 (Biliran (Q13751))
6549 (Biliran (Q406186))
Austria (Q40) 1010–1423 (Vienna (Q1741))
4580 (Windischgarsten (Q681099))
Japan (Q17) \d{3}-\d{4}(–\d{3}-\d{4})? 528-8502 (Kōka-shi (Q847584)),
850-0002–852-8154 (Nagasaki (Q38234))
Switzerland (Q39) \d{4} 3000 (Bern (Q70))
Afghanistan (Q889) ([1-3][0-9]|4[0-3])\d{2}
Netherlands (Q55) \d{4}_[A-Z]{2} 1944 XB (Antillenstraat (Q18938964))
United States (Q30) \d{5}(-\d{4})? 10033-3299 (Yeshiva University (Q1048851)) US ZIP codes do not have a standard "radius" because they represent collections of delivery routes and addresses, not precise, contiguous geographic circular areas. Therefore, there are no official maximum or minimum defined radii.

However, based on the geographic areas they cover: Minimum "radius" (area): The smallest ZIP codes cover very small areas, with one notable example in Long Island City, NY (part of 11109), covering a just a couple of blocks (around 0.1 square miles in area). Maximum "radius" (area): The largest ZIP codes by land area are primarily in Alaska. The largest is 99734 (Prudhoe Bay, AK), which measures over 30,000 square miles. In the contiguous U.S. (lower 48 states), the largest is 89049 (Tonopah, NV), covering over 10,000 square miles. The size of a ZIP code is determined by the population and the efficiency of mail delivery, which is why urban ZIP codes are small and numerous, while rural ones can be vast.

Thailand (Q869) \d{2}(\d{3})? 91 (Satun (Q236263))
82110 (Takua Pa (Q476805))
Variability in Postcode Area Sizes

Small Urban Areas: In urban centers like Bangkok, a single five-digit postcode may cover a specific sub-district (tambon/khwaeng) or even a specific building or post office box range (e.g., Chitralada Palace uses 10303, separate from the main Dusit Post Office's 10300). These areas are geographically small. Large Rural Areas: In rural or less populated provinces, a single postcode might be assigned to an entire large district, which can cover hundreds of square kilometers.

United Kingdom (Q145) (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})?) YO14 (Filey (Q82334)) see The geographic size of a full unit postcode can vary greatly, ranging from a single building's footprint in a dense urban area to potentially a few square miles in a very rural location, this is because they are divided based on the number of addresses and not geographic area
uk-postcode-regex
Brazil (Q155) \d{5}(-\d{3})? 58865-000 (Riachão (Q18482391))
Czech Republic (Q213) \d{3} \d{2}(–\d{3} \d{2})? 512 44–512 45 (Rokytnice nad Jizerou (Q1894625)),
512 46 (Harrachov (Q147816))
No-Break Space used
Slovakia (Q214) \d{3} \d{2}(–\d{3} \d{2})? No-Break Space used
Argentina (Q414) [A-Z]\d{4}([A-Z]{3})? Z9040 (Perito Moreno (Q2061265)),
W3400AMZ (Q16579156)
Kingdom of the Netherlands (Q29999) \d{4} [A-Z]{2}? No-Break Space used
Bangladesh (Q902) [০১২৩৪৫৬৭৮৯0-9]{4} ৪০০০ (Chattogram District (Q1074991))
4393 (Pukuria Union (Q13151422))
Poland (Q36) \d{2}-\d{3}(–\d{2}-\d{3})?
Lithuania (Q37) LT-\d{5} LT-85352 (Vienrankiai (Q12677144))
Latvia (Q211) LV-\d{4} LV-5052 (Ikšķile (Q753029))
Moldova (Q217) MD-\d{4} MD-2055 (Vatra (Q1117303))
Andorra (Q228) AD\d{3}
Azerbaijan (Q227) AZ\d{4}
Please add more


Reuse of properties

[edit]

This property was originally 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)Reply

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

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

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

Ranges

[edit]

How to deal with ranges (e.g. 1400-1403)? 145.53.76.181 21:03, 21 April 2013 (UTC)Reply

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)Reply
using ranges or coma separated values violates atomicity. we should find a better solution. --Akkakk 21:35, 28 June 2013 (UTC)Reply
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)Reply

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

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

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

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

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

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

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

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

Code for Kingdom of the Netherlands (Q29999)

[edit]

@QZanden: about [1]: is low line must be used instead of space? — Ivan A. Krestinin (talk) 18:37, 30 May 2017 (UTC)Reply

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

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:

  1. As as P281-qualifier of 'located on street' P669
  2. 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)Reply

@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 write REPLACE(?PCP281,"(\u00a0| )",""). —Tacsipacsi (talk) 19:10, 7 March 2019 (UTC)Reply
@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)Reply

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

I'd also be very interested to know, and have searched far and wide for an answer to no apparent avail., sadly. WIDEnet (talk) 00:02, 20 July 2025 (UTC)Reply

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

Greece 10671

[edit]

Hello, I removed the postal code 10671 from Theatre Dimitris Ηorn. When the postal code was in Q60685115, the resulting location in the infobox of Commons:Category:Dimitris Horn Theatre, was Athens, Achaia, which is completely wrong. Athens is in Attica. If anyone knows where the postal codes are read from, please correct it there. The 10671 for Greece is wrongly attributed. FocalPoint (talk) 18:27, 3 March 2025 (UTC)Reply

United States ZIP Code enumeration

[edit]

In order to keep our dataset of five-digit postal codes in the United States accurate, I have compiled this table of how many such postal codes there are in each state. When you create a SPARQL query to keep track of these postal codes, you have to make sure each five-digit code appears in your query results exactly once, and that you get the exact number of entries given below for the corresponding regex filter.

This table is accurate as of October 14, 2025, and is sourced from this document.

State/territory Three-digit prefixes Regex filter Expected number of entries
Puerto Rico (Q1183) 006-007,009 ^00[679][0-9]{2}$ 174
United States Virgin Islands (Q11703) 008 ^008[0-9]{2}$ 16
Massachusetts (Q771) 010-027 ^0(1[0-9]{3}|2[0-7][0-9]{2})$ 678
Rhode Island (Q1387) 028-029 ^02[89][0-9]{2}$ 90
New Hampshire (Q759) 030-038 ^03[0-8][0-9]{2}$ 281
Maine (Q724) 039-049 ^0(39[0-9]{2}|4[0-9]{3})$ 485
Vermont (Q16551) [a] 050-059 ^05[0-9]{3}$ 309
Connecticut (Q779) [b] 060-069 ^06[0-9]{3}$ 422
New Jersey (Q1408) 070-089 ^0[78][0-9]{3}$ 721
Armed Forces Europe 090-099 ^09[0-9]{3}$ 368
New York (Q1384) 005,100-149 ^(005[0-9]{2}|1[0-4][0-9]{3})$ 2,142
Pennsylvania (Q1400) 150-196 ^1([5-8][0-9]{3}|9[0-6][0-9]{2})$ 2,162
Delaware (Q1393) 197-199 ^19[7-9][0-9]{2}$ 96
Washington, D.C. (Q61) 200,202-205,569 ^(20[02-5][0-9]{2}|569[0-9]{2})$ 302
Maryland (Q1391) 206-219 ^2(0[6-9][0-9]{2}|1[0-9]{3})$ 600
Virginia (Q1370) 201,220-246 ^2(01[0-9]{2}|[23][0-9]{3}|4[0-6][0-9]{2})$ 1,212
West Virginia (Q1371) 247-269 ^2(4[7-9][0-9]{2}|[56][0-9]{3})$ 851
North Carolina (Q1454) 270-289 ^2[78][0-9]{3}$ 1,079
South Carolina (Q1456) 290-299 ^29[0-9]{3}$ 534
Georgia (Q1428) 300-319,398-399 ^3([01][0-9]{3}|9[89][0-9]{2})$ 941
Florida (Q812) 320-339,341-349 ^3([23][0-9]{3}|4[1-9][0-9]{2})$ 1,457
Armed Forces Americas 340 ^340[0-9]{2}$ 57
Alabama (Q173) 350-369 ^3[56][0-9]{3}$ 799
Tennessee (Q1509) 370-385 ^3(7[0-9]{3}|8[0-5][0-9]{2})$ 785
Mississippi (Q1494) 386-397 ^3(8[6-9][0-9]{2}|9[0-7][0-9]{2})$ 516
Kentucky (Q1603) 400-429 ^4[0-2][0-9]{3}$ 944
Ohio (Q1397) 430-459 ^4[3-5][0-9]{3}$ 1,414
Indiana (Q1415) 460-479 ^4[67][0-9]{3}$ 958
Michigan (Q1166) 480-499 ^4[89][0-9]{3}$ 1,159
Iowa (Q1546) 500-529 ^5[0-2][0-9]{3}$ 1,054
Wisconsin (Q1537) 530-549 ^5[34][0-9]{3}$ 877
Minnesota (Q1527) 550-567 ^5(5[0-9]{3}|6[0-7][0-9]{2})$ 952
South Dakota (Q1211) 570-579 ^57[0-9]{3}$ 385
North Dakota (Q1207) 580-589 ^58[0-9]{3}$ 407
Montana (Q1212) 590-599 ^59[0-9]{3}$ 404
Illinois (Q1204) 600-629 ^6[0-2][0-9]{3}$ 1,568
Missouri (Q1581) 630-659 ^6[3-5][0-9]{3}$ 1,153
Kansas (Q1558) 660-679 ^6[67][0-9]{3}$ 747
Nebraska (Q1553) 680-699 ^6[89][0-9]{3}$ 616
Louisiana (Q1588) 700-715 ^7(0[0-9]{3}|1[0-5][0-9]{2})$ 719
Arkansas (Q1612) 716-729 ^7(1[6-9][0-9]{2}|2[0-9]{3})$ 706
Oklahoma (Q1649) 730-749 ^7[34][0-9]{3}$ 767
Texas (Q1439) 750-799,885 ^(7[5-9][0-9]{3}|885[0-9]{2})$ 2,593
Colorado (Q1261) 800-819 ^8[01][0-9]{3}$ 640
Wyoming (Q1214) 820-831 ^8(2[0-9]{3}|3[01][0-9]{2})$ 193
Idaho (Q1221) 832-839 ^83[2-9][0-9]{2}$ 318
Utah (Q829) 840-849 ^84[0-9]{3}$ 344
Arizona (Q816) 850-869 ^8[56][0-9]{3}$ 519
New Mexico (Q1522) 870-884 ^8(7[0-9]{3}|8[0-4][0-9]{2})$ 427
Operation Santa Claus (Q1389255) 888 (One code: 88888) 1
Nevada (Q1227) 889-899 ^8(89[0-9]{2}|9[0-9]{3})$ 243
California (Q99) 900-961 ^9([0-5][0-9]{3}|6[01][0-9]{2})$ 2,571
Armed Forces Pacific 962-966 ^96[2-6][0-9]{2}$ 173
Hawaii (Q782) [c] 967-968 ^96[78][0-9]{2}$ 138
Guam (Q16635)
Northern Mariana Islands (Q16644)
Federated States of Micronesia (Q702)
Marshall Islands (Q709)
Palau (Q695)
969 ^969[0-9]{2}$ 23
Oregon (Q824) 970-979 ^97[0-9]{3}$ 479
Washington (Q1223) 980-994 ^9(8[0-9]{3}|9[0-4][0-9]{2})$ 715
Alaska (Q797) 995-999 ^99[5-9][0-9]{2}$ 273

[a] This range is to include one postal code in Andover, Massachusetts.
[b] This range is to include Fishers Island, New York.
[c] This range is to include American Samoa and Wake Island.

-- Denelson83 (talk) 22:44, 19 October 2025 (UTC)Reply

Any qualifiers for designating the postal system?

[edit]

I was looking at https://www.wikidata.org/wiki/Q61698 . This town has a German and a Swiss postcode. The same probably exists for other exclaves.

It's kind of clear from the format, but would be nice to mark the postal authority which assigned each postal code. --JensMueller (talk) 20:01, 15 May 2026 (UTC)Reply