Prolog web programming

Viewed 4923

At work, there was a discussion of using prolog as the backend for a rules engine on a web-app.

How would this get tied into existing systems?

Are there available prolog libraries for other languages allowing the invocation of prolog modules?

6 Answers

Some languages make use of a bridge and provide a library for it for example in Python there's PySWIP for single-threaded use, so it doesn't play nicely with web apps. I've found Pengines to be far more versatile.

Pengines are in SWI, they're a way of querying Prolog via HTTP. There's at least a JavaScript, Java, and Python library to interface with them, but it's just a bunch of HTTP requests. Makes it easy to distribute, use as a micro-service, or horizontally scale. Although as anniepoo has witnessed to, a SWI server can handle decent amount of traffic!

Also in the case of JavaScript there's Tau Prolog which compiles to and works within JavaScript.

There's a lot of sense in using a logic language as a rule engine.

Related