RDFLib/rdflib — Issue #43: ASK queries result in exception: bool object is not iterable
Author: gjhiggins
Created: 2012-02-20 08:31:16+00:00
State: open

coryd...@gmail.com, 2009-02-16T18:33:48.000Z

What steps will reproduce the problem?
1. Create a Graph, populated with any triple such as :x :y :z
2. Construct a query such as askQuery = "ASK { :x :y :z }"
3. Run graph.query(askQuery)

Or:

1. Run the attached ask-bug.py file.

Expected:

Return of a result object representing the boolean result.

Actual behavior:

raises this exception.

Traceback (most recent call last):
File "", line 19, in
File "/usr/lib/python2.5/site-packages/rdflib/Graph.py", line 679, in query
return plugin.get('SPARQLQueryResult',QueryResult)(p.query(strOrQuery,
initBindings, initNs, DEBUG))
File "/usr/lib/python2.5/site-packages/rdflib/sparql/QueryResult.py",
line 216, in __init__
result,selectionF,allVars,orderBy,distinct = qResult
TypeError: 'bool' object is not iterable

Using rdflib 2.4.0 installed with pip, on Ubuntu 8.10.

Comment 1 by eik...@gmail.com

Comment 2 by eik...@gmail.com
Added as test case in r1477. Verified that the test case was failing in 2.4.0 as indicated. The test case as written,
{{{ self.assertEquals(res.askAnswer, [True]) }}}, is currently passing in trunk (r1477).

Comment 3 by stephen....@gmail.com
r1480 exposes another error here, where ASK{} will return False when
DAWG_DATASET_COMPLIANCE is set to True, and the triple does exist. This is a seperate
issue to the one seen in this ticket.