SKOS Vocabulary
This format is under active development and likely to change. We welcome feedback via Slack or mailing list.
UN/LOCODE is published as a SKOS (Simple Knowledge Organization System) vocabulary in Turtle format. This makes the code list interoperable with semantic web tools, SPARQL endpoints, and other linked data systems.
The SKOS file is included in the release download archive available on the Publications page.
What is SKOS?
SKOS is a W3C standard for representing code lists, taxonomies, and controlled vocabularies as linked data. Where traditional formats (CSV, XML) require consumers to understand your specific schema, SKOS uses standard terms that any SKOS-aware tool already understands.
Vocabulary Structure
The UN/LOCODE SKOS vocabulary is organised as a hierarchy:
ConceptScheme: UN/LOCODE
├── Concept: AD (Andorra) ← topConceptOf
│ ├── Concept: ADALV (Andorra la Vella) ← broader: AD
│ └── Concept: ADCAN (Canillo) ← broader: AD
├── Concept: GB (United Kingdom)
│ ├── Concept: GBLON (London)
│ └── Concept: GBMAN (Manchester)
└── ...
Concept Schemes
| Scheme | URI | Description |
|---|---|---|
| UN/LOCODE | https://vocabulary.uncefact.org/unlocode | The main vocabulary containing all countries and locations |
| Function Codes | https://vocabulary.uncefact.org/unlocode-functions | Transport and facility function classifiers |
Namespaces
| Prefix | URI |
|---|---|
skos: | http://www.w3.org/2004/02/skos/core# |
dct: | http://purl.org/dc/terms/ |
geo: | http://www.w3.org/2003/01/geo/wgs84_pos# |
unlcd: | https://vocabulary.uncefact.org/unlocode# |
unlcdf: | https://vocabulary.uncefact.org/unlocode-functions# |
SKOS Mapping
| UN/LOCODE field | SKOS property | Notes |
|---|---|---|
| Location name (with diacritics) | skos:prefLabel | Preferred label |
| Location name (without diacritics) | skos:altLabel | Only when different from prefLabel |
| LOCODE code (e.g. "GBLON") | skos:notation | The code identifier |
| Country relationship | skos:broader | Location → Country |
| Scheme membership | skos:inScheme | All concepts link to the ConceptScheme |
| Function codes | skos:related | Links to function code concepts |
| Coordinates | geo:lat, geo:long | WGS84 decimal degrees (extension property) |
Example
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix unlcd: <https://vocabulary.uncefact.org/unlocode#> .
@prefix unlcdf: <https://vocabulary.uncefact.org/unlocode-functions#> .
unlcd:GB a skos:Concept ;
skos:prefLabel "UNITED KINGDOM"@en ;
skos:notation "GB" ;
skos:inScheme <https://vocabulary.uncefact.org/unlocode> ;
skos:topConceptOf <https://vocabulary.uncefact.org/unlocode> .
unlcd:GBLON a skos:Concept ;
skos:prefLabel "London"@en ;
skos:notation "GBLON" ;
skos:inScheme <https://vocabulary.uncefact.org/unlocode> ;
skos:broader unlcd:GB ;
skos:related unlcdf:1, unlcdf:5 .
Usage
Loading into a Triple Store
The Turtle file can be loaded into any RDF triple store (Apache Jena, GraphDB, Blazegraph, etc.) for querying with SPARQL.
Example SPARQL Query
Find all seaports in the United Kingdom:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX unlcd: <https://vocabulary.uncefact.org/unlocode#>
PREFIX unlcdf: <https://vocabulary.uncefact.org/unlocode-functions#>
SELECT ?code ?name WHERE {
?loc skos:broader unlcd:GB ;
skos:notation ?code ;
skos:prefLabel ?name ;
skos:related unlcdf:1 .
}
ORDER BY ?name
Future Plans
- URI resolution — making the
vocabulary.uncefact.orgURIs resolvable via content negotiation, so following a URI returns the concept description - JSON-LD format — an additional serialisation for easier consumption by web applications
- Subdivision hierarchy — adding ISO 3166-2 subdivisions as intermediate concepts between countries and locations