• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

5 Calling Prolog from Python
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog Python interface
        • Calling Prolog from Python
          • Janus class Query
          • Janus and Prolog truth
          • Janus class Term
          • Janus class PrologError

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 truth False. See discussion above.
dict|None janus.Query.next()
Explicitly ask for the next solution of the iterator. Normally, using the Query as 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.

ClioPatria (version V3.1.1-48-gf653ce4)