really happy to see something of a revival of interest for logic programming lately. it's an extremely powerful tool if you know when to reach for it.
replies(2):
The problem has always been getting facts into the prolog system. I’ve been looking for a prolog which is as easy to embed in eg Python or node as a Postgres client and… crickets.
https://github.com/tau-prolog/tau-prolog
https://pyswip.org/ https://www.swi-prolog.org/packages/mqi/prologmqi.html
Unfortunately the tau site's certificate seems to have lapsed sometime in the last week or so, but I swear it's actually very good.
log("2024-10-22", "09:09:23", "Mozilla", "/login").
log("2024-10-23", "09:09:24", "Safari", "/dash").
log("2024-10-24", "09:09:25", "Chrome", "/user").
log("2024-10-25", "09:09:26", "Brave", "/login").
Implementing a transform of a web server log file into Prolog can be as simple as this. In practice you'll have more like ten or twenty fields, of course. Then you can query along the lines of log(Date, Time, "user agent constraint", Resource). and don't have to be as diligent as when stacking grep:s or such.If you already keep all your logs in analytics databases the example isn't very good, but it ought to be easy to see how this trivial technique can be applied elsewhere.