Registry / database / sparqlslurper

sparqlslurper

JSON →
library0.5.1pypypi✓ verified 84d ago

SPARQL Slurper is a Python library that provides an easy way to execute SPARQL queries and iterate over results using rdflib. Version 0.5.1 is the latest stable release, with a maintenance-focused release cadence. It supports Python >=3.7.4.

pip install sparqlslurper
INSTALL
IMPORT
SIG · SPARQLSLURPER
S
sparqlslurper
databasepythonv0.5.1
Install
2.3s avg
Import
331ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.348s · 23.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.3s · import 0.314s · 24MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SlurpyGraph
from sparqlslurper import SlurpyGraph
from sparqlslurper import SlurperGraph
Common typo: 'SlurperGraph' does not exist; use 'SlurpyGraph'.

Load an RDF graph, slurp SPARQL results, and iterate rows.

from sparqlslurper import SlurpyGraph from rdflib import Graph g = Graph() g.parse('https://example.org/data.ttl', format='turtle') slurper = SlurpyGraph(g) for row in slurper.query('SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10'): print(row.s, row.p, row.o)
Debug
Known issues
gotchaSlurpyGraph consumes all query results eagerly; large result sets may cause memory issues.
fix
Use SPARQLWrapper or rdflib's query() directly for streaming if memory is a concern.
affects: all
gotchaQuery results are returned as namedtuple-like objects; field names depend on SPARQL variable names.
fix
Always verify variable names in SELECT clause (e.g., row.s, row.p). Use row.asdict() for dict access.
affects: all
deprecatedThe 'sparqlslurper' package has not seen updates since 2021; consider alternatives like rdflib's query directly.
fix
Use rdflib's Graph.query() or SPARQLWrapper for active development.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'SlurpyGraph' from 'sparqlslurper'
Installed version is too old (pre-0.5.0) or package name mismatch.
fix
Upgrade sparqlslurper: pip install --upgrade sparqlslurper. Correct import: from sparqlslurper import SlurpyGraph.
AttributeError: 'NoneType' object has no attribute 's'
SPARQL query returned no results; .s attribute is accessed on None row.
fix
Check if query returns results: for row in results: ... or handle with if results:.
sparqlslurper.SPARQLQueryError: (sparqlslurper) Query error: ...
Invalid SPARQL syntax or endpoint issues.
fix
Verify SPARQL syntax with an online validator or endpoint URL. Ensure prefixes are declared.
Upgrade
Version history
0.5.1latest on PyPI · released Dec 21, 2021
Audit
Dependencies
rdflibrequiredCore dependency for RDF graph handling and SPARQL query engine.
SPARQLWrapperoptionalOptional: used for remote SPARQL endpoints.
Agent activity
18 hits · last 30 days
node
14
Meta
1
OpenAI (training)
1
Resources
sparqlslurper — pip install sparqlslurper · libregistry