Skip to main content

snapQuery

Just query by name of query ...

snapquery cats
is all you need

This endpoint and query detail independent style of querying wikidata and similar knowledge graph services makes your queries future proof. No worries about blazegraph being replaced, the graph being split or timeouts haunting you. snapquery introduces named queries and named query middleware to wikidata and other knowledge graph endpoints.

snapquery is a tool that simplifies the process of previewing, annotating, rating, commenting, running, and exploring queries across different backends. It enhances user experience by storing query results and allowing easy comparison across various backends and over time.

This tool is designed to assist users in curating and collaborating on queries, ensuring their continued functionality over time. Developers and data consumers can access data conveniently through APIs, streamlining their workflow.

The technology behind the backend knowlede graphs such as RDF, SPARQL, SQL, CSV, APIs is hidden.

PyPi PyPI Status License pypi format downloads
GitHub Github Actions Build Release Contributors Last Commit GitHub issues GitHub closed issues
Code style-black imports-isort Join the discussion at https://github.com/WolfgangFahl/snapquery/discussions
Docs API Docs formatter-docformatter style-google
Cite DOI

Cite as

If you use snapquery in your research, please cite it via its Zenodo concept DOI (which always resolves to the latest version):

Fahl, W., Holzheim, T., Hoyt, C. T., Priskorn, D., & Willighagen, E. SnapQuery — FAIR Management of Query Sets to Mitigate Query Rot in Knowledge Graphs. Zenodo. https://doi.org/10.5281/zenodo.17802424

Machine-readable metadata is available in CITATION.cff; GitHub's "Cite this repository" button and Zenodo pick it up automatically. For a specific release, use the version DOI shown on the corresponding Zenodo record.

Demos

Background

In the Wikimedia ecosystem, we now boast several SPARQL engines and backends housing the complete Wikidata graph for querying purposes.

Over recent years, WDQS has encountered escalating timeouts as the graph expands. Users desire alternative endpoints without grappling with disparities among SPARQL engines and their impact on query construction.

Recognizing the needs of Wikidata data consumers, we aim to establish a system that simplifies:

  • Discovering pre-existing queries
  • Facilitating easy forking, sharing, rating, and monitoring of queries
  • Executing queries (or their variations) on diverse endpoints
  • Comparing query results over time and/or across multiple endpoints
  • Cultivating a collaborative community for query construction
  • Ensuring the reliability of query results
  • Providing alerts if a query no longer yields the expected results
  • Developing tools that access data from dependable, middleware-cached queries via an accessible API, eliminating delays for downstream users.

Links

Docs

Model

Class Diagram

Authors

Features

Planned

These are the planned features

  • support for naming queries (#9) ✅
  • support for sharing queries (unique identifier) (#2) ✅
  • query multiple backends simultaneously and repeatedly ✅
  • stores queries and adaptations needed for different backends ✅
  • support user login ✅
  • support for spam protection
  • support for rating queries
  • support for commenting on queries
  • support for detecting when a query returns different results between different backends ✅
  • support for query states: reliable, needs investigation, need verification ✅
  • support for autodetecting when a query returns fewer results than before (change in underlying data/model in Wikidata) -> needs investigation
  • support for marking queries as reliable query by users
  • support for seeing a state history per query ✅
  • support for storing query results so you don’t have to wait
  • support for adding metadata to queries
    • add main subject (QID) to query
    • author -> id of author in the system
    • forked from x
  • has REST API for data consumers e.g. LLM developers who want to present user-verified queries and data to users to increase reliability ✅

User stories

  • as a user I want to know in advance if the query is returning what I expect
  • as a user I want to find all the rock bands starting with 'M' in Wikidata without having to know how it is modeled
  • as a user I want pay someone to help me get the information from Wikidata that I need
  • as a user I want to know how a query performed in the past so I can trust that the underlying model is stable and I get the expected results
  • as a user I want to comment on a query
  • as a user I want to read comments from others on a query so I get and idea how reliable it is
  • as a user I want to rate a query with 1-5 stars
  • as a user I want to get information from multiple sparql engines at the same time
  • as a user I don’t want to wait for a fresh query to finish and just get the information from the latest time a query succeeded.
  • as a user I want a list of queries in the middleware
  • as a user I want to sort the list based on the rate of queries
  • as a user I want to annotate a query with a name
  • as a user I want to annotate a query with a wikidata item as main subject
  • as a user I want to see a list of queries that is tagged with a certain topic (wikidata item)
  • as a user I want an API to get information from the middleware about queries
  • as a user I want an api endpoint /list that gives me all queries with the main subject=Qxxxx
  • as a user I want the system to warn me and annotate a query that no longer returns the data the user expects, ie. if a query suddenly start returning no results or fewer results
  • as a user I want to see a state on a query
  • as a user I want to log in using github to avoid the hassle of creating another account
  • as a user I want to log in using gitlab to avoid the hassle of creating another account
  • as a user I want to log in using facebook to avoid the hassle of creating another account
  • as a user I want to know how many backends a query is working on, so I get an overview
  • as a user I want to get query results immediately if possible so I don’t have to wait
  • as a user I want to import a query by copy pasting a url from WDQS
  • as a user I want to run a query on multiple backends with one click
  • as a user I want to fork a query and build on it
  • as a user I want an email if a query I'm watching needs investigation
  • as a user I want settings to control whether I get email notifications or not for all queries I'm watching
  • as a user I want to watch a query
  • as a user I want to see the history of actions of other users
  • as a user I want to know who created a query
  • as a user I want a setting to get email about new comments on queries I'm watching
  • as a user I want a setting to get emails about new queries every day, week, month
  • as a user I want to star a query
  • as a user I want to browse queries and sort by number of stars
  • as a user I want to see who starred a query
  • as a user I want to see a list of my notifications
  • as a wikidata contributor I want to be able to override the “bad query” state
  • as a wikidata user I want to be able to log in using my wmf credentials to avoid the hassle of creating another account
  • as a wikidata user I want to link my current account to my wmf account so others can find me by username
  • as a developer I want to expose the data in API endpoints
  • as a LLM developer I want to consume the queries and use them to improve my LLM so it can suggest KNOWN GOOD queries to users

Metadata

Release files for snapquery 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snapquery 0.2.6
File Size Uploaded Provenance Actions
snapquery-0.2.6.tar.gz 1.0 MB With provenance Details for snapquery-0.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snapquery 0.2.6
File Interpreter ABI Platform Actions
snapquery-0.2.6-py3-none-any.whl Python 3 none any Details for snapquery-0.2.6-py3-none-any.whl

Total release size: 2.0 MB

Release files / snapquery-0.2.6.tar.gz

Download URL snapquery-0.2.6.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
70e698c88425c379d8064b26da09433e6d8d4f61f07dab38da15acd140927e7a
BLAKE2b-256 checksum
How to use checksums
3a54f0a9b6a10beccbf3e45df55fbbf6e552a179cb03bdab1f57276b2850f2a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / snapquery-0.2.6-py3-none-any.whl

Download URL snapquery-0.2.6-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e07ba82fa7d0c0ad2c96e31c68a79d914d5d8e6fc02190fcb739fc7ed0ed0d8c
BLAKE2b-256 checksum
How to use checksums
d88a2fb341bdd8992f3552ead9e4a903783be1847f6f540526df668cfd45eb2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for snapquery 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for snapquery-0.2.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page