SPARQLWrapper
SPARQL Endpoint interface to Python
Decision gist · record as of 2026-08-14
Yes. SPARQLWrapper is a mature, actively maintained library with low install friction and no known vulnerabilities. It's the standard Python tool for SPARQL endpoint access. Install it if you need to query remote RDF data sources; the only caveat is to review the W3C license terms for your use case.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a live SPARQL endpoint URL; queries will fail if the endpoint is unreachable or does not support the requested query type.
- Low install friction with a single runtime dependency (rdflib).
- Actively maintained with recent commits and ongoing repository activity.
License · maintenance · safety
W3C SOFTWARE NOTICE AND LICENSE (unclear) — Licensed under W3C SOFTWARE NOTICE AND LICENSE with unclear SPDX mapping. Review the license text before use in proprietary or commercial contexts to confirm compatibility with your project's requirements.
last release 2022-03-13 (1615 days) · last repo commit 2026-04-30 · 565 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,424,048 downloads/mo, #3,919 on PyPI
Alternatives
Verify before relying
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setReturnFormat(JSON)
sparql.setQuery("SELECT * WHERE { ?s ?p ?o } LIMIT 1")
results = sparql.queryAndConvert()
print(results["results"]["bindings"])- Whether the W3C SOFTWARE NOTICE AND LICENSE is compatible with common open-source or proprietary licensing frameworks.
- Current status of the package relative to SPARQL 1.1 specification compliance.
What it is and what it does
SPARQLWrapper is a Python client library that abstracts the complexity of communicating with remote SPARQL endpoints over HTTP. It lets you write SPARQL queries (SELECT, ASK, CONSTRUCT, DESCRIBE, UPDATE) in Python code, handles the HTTP protocol details, and automatically converts responses into Python-friendly formats—JSON objects, XML trees, or rdflib Graph objects—depending on the query type and your chosen return format.
The package is built on rdflib and supports multiple authentication methods, HTTP verbs, and result serializations. It includes both a Python API for programmatic use and a command-line tool (rqw) for ad-hoc queries. It's stable (Production/Stable status), supports Python 3.7, 3.8, 3.9, and 3.10, and has been in active maintenance.
Use it for
- Query DBpedia or other public linked-data endpoints to retrieve structured facts about entities (people, places, concepts).
- Build a semantic search or knowledge-graph application that needs to fetch RDF data from a remote triple store.
- Integrate SPARQL queries into data pipelines that combine linked data with other Python data processing libraries.
- Prototype or test SPARQL queries against a development endpoint before deploying them to production systems.
- Retrieve and transform RDF graphs from remote endpoints into formats suitable for analysis or visualization.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
SPARQLWrapper is a mature, actively maintained library with low install friction and no known vulnerabilities. It's the standard Python tool for SPARQL endpoint access. Install it if you need to query remote RDF data sources; the only caveat is to review the W3C license terms for your use case.
Install
sparqlwrapper on PyPI
Before you install
Low install friction with a single runtime dependency (rdflib). Actively maintained with recent commits and ongoing repository activity.
Requires a live SPARQL endpoint URL; queries will fail if the endpoint is unreachable or does not support the requested query type.
License in practice
Licensed under W3C SOFTWARE NOTICE AND LICENSE with unclear SPDX mapping. Review the license text before use in proprietary or commercial contexts to confirm compatibility with your project's requirements.
Quickstart
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setReturnFormat(JSON)
sparql.setQuery("SELECT * WHERE { ?s ?p ?o } LIMIT 1")
results = sparql.queryAndConvert()
print(results["results"]["bindings"])
Verify before relying
- Whether the W3C SOFTWARE NOTICE AND LICENSE is compatible with common open-source or proprietary licensing frameworks.
- Current status of the package relative to SPARQL 1.1 specification compliance.
Package facts
| License | W3C SOFTWARE NOTICE AND LICENSE unclear |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagerdflib |
| Maintenance | Actively maintained 1,615 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,424,048 / month, #3,919 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: W3C LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries :: Python Modules |
Evidence: SPARQLWrapper-2.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “rdf query python”
- SPARQLWrapperSPARQLWrapper provides a Python interface to query remote SPARQL…
- rdflibRDFLib is a Python library for parsing, querying, and serializing RDF…
- pyoxigraphPyoxigraph is a Python library that provides in-memory and disk-based…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also sparqlslurper · rdflib · pymantic · owlrl · CFGraph · rdflib-jsonld · pyoxigraph · pystardog · owlready2 · prefixmaps