I am trying to run a sparql query on a local rdf dataset. The dataset is parsed successfully. The following query containing the group by clause gives the exception 'Cannot eval thing: None (<class 'NoneType'>)'
select (COUNT(?person) as ?cnt) ?name where {
?person <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://swrc.ontoware.org/ontology#Person> .
?person <http://swrc.ontoware.org/ontology#affiliation> ?aff .
# ?aff a <http://swrc.ontoware.org/ontology#affiliation>.
?aff <http://swrc.ontoware.org/ontology#name> ?name .
} group by(?name)
If I remove the brackets from the variable name in the group by clause like below the query works fine without any errors.
select (COUNT(?person) as ?cnt) ?name where {
?person <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://swrc.ontoware.org/ontology#Person> .
?person <http://swrc.ontoware.org/ontology#affiliation> ?aff .
# ?aff a <http://swrc.ontoware.org/ontology#affiliation>.
?aff <http://swrc.ontoware.org/ontology#name> ?name .
} group by ?name
I cannot see why the brackets would cause an error or how I should use rdflib to work with that format too. Any help would be really appreciated!