{"id":22389,"library":"sparqlslurper","title":"SPARQL Slurper for rdflib","description":"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.","status":"active","version":"0.5.1","language":"python","source_language":"en","source_url":"https://github.com/hsolbrig/sparqlslurper","tags":["sparql","rdflib","rdf","graph","query"],"install":[{"cmd":"pip install sparqlslurper","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for RDF graph handling and SPARQL query engine.","package":"rdflib","optional":false},{"reason":"Optional: used for remote SPARQL endpoints.","package":"SPARQLWrapper","optional":true}],"imports":[{"note":"Common typo: 'SlurperGraph' does not exist; use 'SlurpyGraph'.","wrong":"from sparqlslurper import SlurperGraph","symbol":"SlurpyGraph","correct":"from sparqlslurper import SlurpyGraph"}],"quickstart":{"code":"from sparqlslurper import SlurpyGraph\nfrom rdflib import Graph\n\ng = Graph()\ng.parse('https://example.org/data.ttl', format='turtle')\n\nslurper = SlurpyGraph(g)\nfor row in slurper.query('SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10'):\n    print(row.s, row.p, row.o)","lang":"python","description":"Load an RDF graph, slurp SPARQL results, and iterate rows."},"warnings":[{"fix":"Use SPARQLWrapper or rdflib's query() directly for streaming if memory is a concern.","message":"SlurpyGraph consumes all query results eagerly; large result sets may cause memory issues.","severity":"gotcha","affected_versions":"all"},{"fix":"Always verify variable names in SELECT clause (e.g., row.s, row.p). Use row.asdict() for dict access.","message":"Query results are returned as namedtuple-like objects; field names depend on SPARQL variable names.","severity":"gotcha","affected_versions":"all"},{"fix":"Use rdflib's Graph.query() or SPARQLWrapper for active development.","message":"The 'sparqlslurper' package has not seen updates since 2021; consider alternatives like rdflib's query directly.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade sparqlslurper: pip install --upgrade sparqlslurper. Correct import: from sparqlslurper import SlurpyGraph.","cause":"Installed version is too old (pre-0.5.0) or package name mismatch.","error":"ImportError: cannot import name 'SlurpyGraph' from 'sparqlslurper'"},{"fix":"Check if query returns results: for row in results: ... or handle with if results:.","cause":"SPARQL query returned no results; .s attribute is accessed on None row.","error":"AttributeError: 'NoneType' object has no attribute 's'"},{"fix":"Verify SPARQL syntax with an online validator or endpoint URL. Ensure prefixes are declared.","cause":"Invalid SPARQL syntax or endpoint issues.","error":"sparqlslurper.SPARQLQueryError: (sparqlslurper) Query error: ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}