wdmapper can be used both, as command line application and as Python library. This document first describes how to install and invoke wdmapper from the command line.

Getting mappings and property information

The following call looks up three mappings from Wikidata to World Heritage Site identifiers as assigned by UNESCO:

$ wdmapper get P757 --limit 3

Wikidata properties can also be referenced by their label, URI or URL. The call could also be written like this:

$ wdmapper get 'World Heritage Site ID' --limit 3
$ wdmapper get '' --limit 3
$ wdmapper get '' --limit 3

To get the mappings in stable order, add option sort. This will slow down the query so use with care! The default output format is called BEACON, so some mapping metadata is placed in front of the mappings:

$ wdmapper get P757 --limit 3 --sort
#NAME: World Heritage Site ID
#DESCRIPTION: Mapping from Wikidata IDs to World Heritage Site IDs

Q319841|Luxor Temple|087-002
Q38095|Galápagos Islands|1
Q6153869|Lower Valley of the Awash|10

If only interested in the metadata Use command head instead of get. This command only loops up property information, resulting in a much quicker response — useful to look up what some property id refers to. Command head is assumed as default so the following calls are equivalent:

$ wdmapper head P757
$ wdmapper P757

Some output formats emit mappings without metadata:

$ wdmapper get P757 --limit 3 --sort --to csv
source, target, annotation
Q319841, 087-002, Luxor Temple
Q38095, 1, Galápagos Islands
Q6153869, 10, Lower Valley of the Awash

The second output line tells that Wikidata item with id Q319841 (source column) is linked to World Heritage Site with id 087-002 (target column). The third column (annotation, put in the middle in BEACON format) gives the item label for better readability.

In NTriples output format, identifiers are expanded to full URIs. The expansion is based on URI templates of each property (see metadata fields PREFIX and TARGET above):

$ wdmapper get P757 --limit 3 --sort --to nt --relation owl:sameAs
<> <> <> .
<> <> <> .
<> <> <> .

The last example shows how to connect multiple authority files. If two properties are given, wdmapper retrieves mappings from the first (source) to the second (target). The following call lists all Wikidata items that have both a TED speaker ID (, and a Find a Grave grave ID (

$ wdmapper get P2611 P535
#NAME: Find a Grave grave ID
#DESCRIPTION: Mapping from TED speaker IDs to Find a Grave grave IDs


In the case of such “indirect links”, the annotation field is used to give the Wikidata item identifier.