Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COUNT is not working #777

Closed
ReshmaDangol opened this issue Oct 28, 2017 · 2 comments
Closed

COUNT is not working #777

ReshmaDangol opened this issue Oct 28, 2017 · 2 comments

Comments

@ReshmaDangol
Copy link

When running the following query, I get error.

g = Graph()
g.parse("demo.nt", format="nt")
qres = g.query("""
SELECT count(*)
where{?s ?p ?o}
""")

Error:
File "/usr/local/lib/python2.7/dist-packages/rdflib/graph.py", line 1085, in query
query_object, initBindings, initNs, **kwargs))
File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/sparql/processor.py", line 74, in query
parsetree = parseQuery(strOrQuery)
File "/usr/local/lib/python2.7/dist-packages/rdflib/plugins/sparql/parser.py", line 1058, in parseQuery
return Query.parseString(q, parseAll=True)
File "/usr/local/lib/python2.7/dist-packages/pyparsing-1.5.7-py2.7.egg/pyparsing.py", line 1006, in parseString
raise exc
pyparsing.ParseException: Expected "?" (at char 7), (line:1, col:8)

@ReshmaDangol ReshmaDangol changed the title count is not working COUNT is not working Oct 28, 2017
@joernhees
Copy link
Member

heh, yes, sorry... virtuoso allows this, but we're closer to the sparql spec and require

select (count(*) as ?c) where {?s ?p ?o}

@ReshmaDangol
Copy link
Author

Thank you for the clarification. I was nearly going insane over it the other day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants