5.1 Janus class Query
Class janus.Query() is similar to the janus.once() function, but it returns a Python iterator that allows for iterating over the answers to a non-deterministic Prolog predicate.
- Query janus.Query(query, bindings={}, keep=False)
- As janus.once(), returning an iterator
that provides an answer dict as janus.once()
for each answer to query. Answers never have
truthFalse. See discussion above. - dict
|None janus.Query.next() - Explicitly ask for the next solution of the iterator. Normally, using
the
Queryas an iterator is to be preferred. See discussion above. - None janus.Query.close()
- Close the query. Closing a query is obligatory. When used as an iterator, the Python destructor (__del__()) takes care of closing the query.