在工作中,有人讨论过使用 prolog 作为 Web 应用程序上的规则引擎的后端。
这将如何与现有系统联系起来?
是否有其他语言的可用 prolog 库允许调用 prolog 模块?
在工作中,有人讨论过使用 prolog 作为 Web 应用程序上的规则引擎的后端。
这将如何与现有系统联系起来?
是否有其他语言的可用 prolog 库允许调用 prolog 模块?
对于SWI-Prolog,您可以查看在 Prolog中支持SWRL的Thea2 ,也可以通过JPL连接到外部推理器,例如用于 OWL/SWRL 推理的HermiT或Pellet等。
就个人而言,我过去曾多次使用JPL来启用具有 SWI-Prolog 后端的 Web 应用程序,如果您打算使用可在 JVM 上执行的语言(如 Java)对 Web 应用程序进行编程,它就可以正常工作、Groovy 或 Scala,例如。另一种选择是将 SWI-Prolog 挂接到C或C++ 环境中,我还没有为 web 应用程序尝试过。
如果您的 Web 应用程序正在使用另一种不在 JVM 或 C/C++ 中运行的开发语言,那么这可能不适合您,因为连接正在运行的 SWI-Prolog 似乎有点困难环境到其他语言环境。然而,话虽如此,我们之前已经成功地使用HTTP实现了 SWI-Prolog 到任何东西的桥接,但如果性能是必需的,这并不理想。
swi-prolog has a perfectly reasonable HTTP server/ web framework included.
You could talk to it over HTTP.
There are tools for parsing XML/SGML and JSON, and ODBC
我不确定您到底在寻找什么,但您可能想查看Yield Prolog ,它允许将 Prolog 代码嵌入到使用 Python、C# 或 Javascript 的程序中。不涉及 API。我自己(还)没有使用过这个,但它可能适合你想要做的事情。
I guess an important prerequisite for web embedding, especially on the server side, is multi theading capability of the Prolog system. At least you would probably need this, if you want to serve multiple users concurrently.
You can then opt either for a pure solution, where the pages are generated and maintained by Prolog itself. Or maybe for a mix solution, where the Prolog system is only used for some business logic and another programming language is used for presentation and/or storage.
The following Wiki comparison table gives an overview of Prolog systems and whether they are multi threaded and/or support some web programming:
Comparison of Prolog implementations,
Operating system and Web-related features
For my own take on this problem I have set up a little tutorial that shows the use of the Jekejeke Runtime for server side business logic. Jekejeke Runtime is quite flexible, you can not only have multiple threads, you can also have multiple knowledge bases.
Jekejeke Runtime,
Deployment Methods
The Jekejeke Runtime is for example currently used in a productive sales system, by some custom read/write locks, it allows even remote hot swap of the knowledge base by an administrator without restarting the web context. Unfortunately there is no report yet on that.
Bye
某些语言使用桥接器并为其提供库,例如在 Python 中,PySWIP 用于单线程使用,因此它不能很好地与 Web 应用程序配合使用。我发现 Pengines 更加通用。
Pengines 在 SWI 中,它们是通过 HTTP 查询 Prolog 的一种方式。至少有一个 JavaScript、Java 和 Python 库可以与它们交互,但它只是一堆 HTTP 请求。使其易于分发、用作微服务或水平扩展。尽管正如 anniepoo 所见证的那样,SWI 服务器可以处理大量的流量!
在 JavaScript 的情况下,还有 Tau Prolog,它可以编译并在 JavaScript 中工作。
使用逻辑语言作为规则引擎有很多意义。
LPA Prolog 已广泛用于各种基于 Web 的商业应用程序,其中最引人注目的是 Business Integrity 的行业领先文档组装产品 DealBuilder
LPA 为交付基于 Web 的应用程序提供各种体系结构 - 其中一些在 LPA 网站 www.lpa.co.uk 的 VisiRule 部分中显示
克莱夫