Skip to main content

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


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-2021.2.5.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wikidata_dl-2021.2.5-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file wikidata_dl-2021.2.5.tar.gz.

File metadata

  • Download URL: wikidata_dl-2021.2.5.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for wikidata_dl-2021.2.5.tar.gz
Algorithm Hash digest
SHA256 4ddeb97a0ba17d4bd2e25652c7af108a5c7ed00e8f09d1ca518f1bdbb56adca2
MD5 66ebb3f6545ab73a3bf3c14c9fdaa83c
BLAKE2b-256 3d56096408ab266e8294901aed283ead48e2b68dd8583d171a382e7b8b74a83f

See more details on using hashes here.

File details

Details for the file wikidata_dl-2021.2.5-py2.py3-none-any.whl.

File metadata

  • Download URL: wikidata_dl-2021.2.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.7

File hashes

Hashes for wikidata_dl-2021.2.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 979bf1b386770ab30fb2a30c5047b1b0ae9baecbac2de38620337b2856b9687c
MD5 a2cd12ca2860dd69c0fa416fff1bf7a4
BLAKE2b-256 f77adde4b73dc66e33704c8b0decc4e998dcc294e29e459c564a40a26b9c462f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page