I am pleased to announce the 0.1.2 version of PySWIP. PySWIP is a GPL'd Python/SWI-Prolog bridge enabling to query SWI- Prolog in your Python programs. PySWIP includes both an (incomplete) SWI-Prolog foreign language interface and a utity class that makes it easy querying SWI-Python. Since it uses SWI-Prolog as a shared library and ctypes to access it, PySWIP doesn't require compilation to be installed. Example -------
from pyswip.util import Prolog prolog = Prolog() prolog.assertz("father(michael,john)") prolog.assertz("father(michael,gina)") list(prolog.query("father(michael,X)")) [{'X': 'john'}, {'X': 'gina'}] for soln in prolog.query("father(X,Y)"): ... print soln["X"], "is the father of", soln["Y"] ... michael is the father of john michael is the father of gina
Requirements ------------ * Python 2.3 and higher (most probably other versions will also work). * ctypes 0.9.9.9 and higher (most probably other versions will also work). * SWI-Prolog 5.6.x and higher(most probably other versions will also work). * libpl as a shared library. * Tested only on Linux, should be working for other POSIX and Win32. Changes since 0.1.1 ------------------- * Renamed PrologRunner to Prolog. * Removed query method of Prolog, queryGenerator is renamed as query. * Added asserta, assertz and consult methods to Prolog. * The necessary cleanup is done even if the query generator doesn't run to the end. * Errors during the execution of query is caught and PrologError is raised. * Many new additions to the core library. * Added examples directory. * Added examples, 'coins' and 'draughts'. * Added Windows installer. PySWIP homepage is at: http://code.google.com/p/pyswip Downloads at: http://code.google.com/p/pyswip/downloads/list Regards, Yuce Tekol