Skip to main content

SKOS Vocabulary

ALPHA

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

SchemeURIDescription
UN/LOCODEhttps://vocabulary.uncefact.org/unlocodeThe main vocabulary containing all countries and locations
Function Codeshttps://vocabulary.uncefact.org/unlocode-functionsTransport and facility function classifiers

Namespaces

PrefixURI
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 fieldSKOS propertyNotes
Location name (with diacritics)skos:prefLabelPreferred label
Location name (without diacritics)skos:altLabelOnly when different from prefLabel
LOCODE code (e.g. "GBLON")skos:notationThe code identifier
Country relationshipskos:broaderLocation → Country
Scheme membershipskos:inSchemeAll concepts link to the ConceptScheme
Function codesskos:relatedLinks to function code concepts
Coordinatesgeo:lat, geo:longWGS84 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.org URIs 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