在没有 pl 文件的情况下使用 prolog

Using prolog without the pl file

我的 python 应用程序运行良好,并使用 swi_prolog 的咨询、断言和查询功能以及一个 pl 文件。但是,当我通过网络调用代码时(尝试打开 pl 文件时,我在咨询时遇到访问错误)。

所以,我想到了不用pl文件咨询就用prolog。我只是想以某种方式将 pl 文件内容嵌入到 prolog 中,以便我可以以类似的方式使用它并继续执行查询步骤。有没有人可以指导我这样做?

提前致谢, 费尔达

SWI-Prolog 手册有一章关于 deploying applications. In particular, it allows you to create so-called saved states of your program. This mechanism allows you to create a stand-alone package from your application, either from inside the application or from the command line