Relational/Logic Programming in Python?

不问归期 提交于 2019-11-29 20:09:45
Richie

Perhaps you should google "Logic Programming in Python". Pyke looks promising:

Pyke introduces a form of Logic Programming (inspired by Prolog) to the Python community by providing a knowledge-based inference engine (expert system) written in 100% Python.

Unlike Prolog, Pyke integrates with Python allowing you to invoke Pyke from Python and intermingle Python statements and expressions within your expert system rules.

You may want to use pyDatalog, a logic programming library that I developed for Python implementing Datalog. It also works with SQLAlchemy to query relational databases using logic clauses.

LogPy is an implementation of miniKanren, a relational programming language, in Python. It follows in th tradition of core.logic, the preeminent logic programming solution in Clojure. LogPy was designed for interoperability with pre-existing codebases.

Another option is Yield Prolog

As we are heading toward 2019, I recommend PySWIP over others recommended here. It is actively maintained and has an easy interface, unlike Pyke (9 years ago) or PyLog (6 years ago).

You could also look at Dee, which adds relations to Python: http://www.quicksort.co.uk

A recent Prolog implementation in Python (or rather RPython) in Pyrolog. It is still rather experimental.

You should also check PyLog:

http://cdsoft.fr/pylog/

It has a very clean and simple syntax and implementation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!