When executing a SPARQL query using the query() method in RDFLib 7.0, a TypeError: Param.postParse2() missing 1 required positional argument: 'tokenList' error is raised. This error did not occur in previous versions of RDFLib, such as version 6.2.
from rdflib import Graph, Namespace, RDF
# Graph
g = Graph()
c = Namespace("http://example.org/c/")
rdf = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
g.bind("c", c)
g.bind("rdf", rdf)
# Add triples to the graph
g.add((c.Individual1, RDF.type, c.SomeClass))
g.add((c.Individual2, RDF.type, c.SomeClass))
g.add((c.Individual3, RDF.type, c.AnotherClass))
# Define the SPARQL query
my_query = """
PREFIX c: <http://example.org/c/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?s WHERE { ?s rdf:type c:SomeClass }
"""
# Execute the query
results = g.query(my_query)
for row in results:
print(f"Subject: {row.s}")
Environment
Library: RDFLib
Version: 7.0
Python: 3.12.3 (packaged by conda-forge)
Operating System: Linux
Expected Behavior
The SPARQL query should execute correctly, returning subjects of type c:SomeClass without raising any errors.
Observed Behavior
Executing the script raises the following error:
Error: Param.postParse2() missing 1 required positional argument: 'tokenList'
Additional Comments
This error does not occur with RDFLib 6.2, suggesting the issue is specific to version 7.0 of the library.
I'm closing this issue, because I was mistaken about the version I originally thought I was using. Probably a problem with my environment. Tested with version 7.0, and result ok.
When executing a SPARQL query using the query() method in RDFLib 7.0, a TypeError: Param.postParse2() missing 1 required positional argument: 'tokenList' error is raised. This error did not occur in previous versions of RDFLib, such as version 6.2.
Environment
Expected Behavior
The SPARQL query should execute correctly, returning subjects of type c:SomeClass without raising any errors.
Observed Behavior
Executing the script raises the following error:
Error: Param.postParse2() missing 1 required positional argument: 'tokenList'
Additional Comments
This error does not occur with RDFLib 6.2, suggesting the issue is specific to version 7.0 of the library.
Workaround
Use RDFLib 6.2 until this issue is resolved.