Skip to content

NathanHowell/existing-statements

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

existing-statements

Generate ready-to-run QuickStatements v2 batches straight from live Wikidata entities.

What it does

  • Pulls the requested entities from Wikidata and rewrites their labels, descriptions, aliases, statements, qualifiers, references, and sitelinks as QuickStatements commands.
  • Prioritises a preferred language while keeping every other language value that exists on the entity.
  • Maintains qualifiers, references, and statement ranks so the imported batch mirrors Wikidata exactly.
  • Accepts any number of QIDs, removes duplicates, and emits the results in the same order they were requested.
  • Can throttle requests to respect rate limits, and can emit the raw entity payload as prettified JSON for inspection or diffing.

Installation

  1. Install the Rust toolchain from rustup.rs if it is not already available.

  2. Clone this repository and change into the project directory.

  3. Build and install the command-line tool:

    cargo install --path .

    The binary will be placed in Cargo’s bin directory (usually ~/.cargo/bin).

To try it without installing, use cargo run --release -- <args> from the project root.

Usage

Fetch a single entity and generate a QuickStatements batch:

existing-statements Q42

Select a preferred language for labels and descriptions while keeping the rest:

existing-statements Q42 Q1 --language es

Throttle API calls when processing many entities:

existing-statements Q42 Q1 Q2 --max-rate 1.5

Inspect the fetched entities by exporting the structured JSON instead of QuickStatements:

existing-statements Q42 --format json

The command exits with a non-zero status if any entity cannot be fetched. Successful runs print the generated batch to standard output; redirect it to a file and feed it straight into QuickStatements.

Tips

  • Combine the output with QuickStatements’ “Import commands” dialog to seed new items or replicate an existing entity before editing.
  • Use quickstatements.md in this repository as a reference for how the generator lays out commands and how QuickStatements interprets each field.
  • When working through large lists of entities, consider batching them by 50 QIDs or less to keep output manageable and stay friendly to the API.

About

Generate quickstatements from existing Wikidata entities

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages