Prolog web programming

不问归期 提交于 2019-12-03 16:55:43

问题


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?


回答1:


For SWI-Prolog, you could look to Thea2 which has support for SWRL in Prolog and can also be attached to external reasoners via JPL such as HermiT for OWL/SWRL reasoning, or Pellet, etc.

On a personal note, I have used JPL several times in the past to enable web-apps with a SWI-Prolog backend, which works just fine if you intend to program your web app using a language which is executable on a JVM, like Java, Groovy, or Scala, for example. Another alternative would be to hook SWI-Prolog into a C or C++ environment, which I haven't tried for a web-app.

If your web-app is using another development language that doesn't run on a JVM or in C/C++, then this mightn't be the right path for you as it seems to be a bit harder to connect a running SWI-Prolog environment to other language environments. However, that said, we have successfully implemented a SWI-Prolog-to-anything bridge using HTTP before, but this is less than ideal if performance is a necessity.




回答2:


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




回答3:


I'm not sure exactly what you're looking for, but you may want to look into Yield Prolog , which allows the embedding of Prolog code into programs using Python, C#, or Javascript. There is no API involved. I haven't used this myself (yet), but it may be amenable to what you're trying to do.




回答4:


LPA Prolog has been widely used in various commercial web-based applications, most noticeably within Business Integrity's industry-lead document assembly product, DealBuilder

LPA provide various architectures for deliverying web-based applications - some of which are shocased within the VisiRule section on the LPA web-site www.lpa.co.uk

Clive




回答5:


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



来源:https://stackoverflow.com/questions/3790994/prolog-web-programming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!