Download data from Wikidata based on input SPARQL query.
Project description
wikidata-dl
Description
wikidata-dl is a command line program for downloading data from Wikidata based on SPARQL queries.
Installation
pip install wikidata_dl
Usage
Download all results returned by the query and store them in the wikidata
directory in the current working directory:
wikidata-dl /path/to/my-query.sparql
Show only the result count returned by the query without downloading anything:
wikidata-dl --dry-run /path/to/my-query.sparql
For a complete reference of the command line options run:
wikidata-dl --help
Sample Query
The following query returns IDs for all Wikidata entities that are an instance of (P31) a continent (Q5107).
SELECT ?item WHERE {
?item wdt:P31 wd:Q5107.
}
Conventions
- The SPARQL query you pass to the program must return Wikibase IDs.
- The query variable where the entity ID is stored must be called
item
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wikidata_dl-2019.11.20.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for wikidata_dl-2019.11.20-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d56a4557191a7caeaa8e81b6d26f9523afb2df457ebc2c378266950824dcdaa |
|
MD5 | 6f725178c8483ce3f8f848aecb73737c |
|
BLAKE2b-256 | 6d55e3c773d8c288ff4bf549d12b8886f29880e53c093312af2b216bdd819977 |