Relational/Logic Programming in Python?

2019-01-21 11:09发布

I'm a longtime python developer and recently have been introduced to Prolog. I love the concept of using relationship rules for certain kinds of tasks, and would like to add this to my repertoire.

Are there any good libraries for logic programming in Python? I've done some searching on Google but only found the following:

jtauber's blog series on relational_python

Would love to compare to some others...thanks!

-aj

8条回答
▲ chillily
2楼-- · 2019-01-21 11:20

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

查看更多
Summer. ? 凉城
3楼-- · 2019-01-21 11:21

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.

查看更多
乱世女痞
4楼-- · 2019-01-21 11:36

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.

查看更多
手持菜刀,她持情操
5楼-- · 2019-01-21 11:39

Another option is Yield Prolog

查看更多
劫难
6楼-- · 2019-01-21 11:40

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.

查看更多
ら.Afraid
7楼-- · 2019-01-21 11:41

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

查看更多
登录 后发表回答