Does a JSON-RPC server exist for answering general Prolog queries?

一笑奈何 提交于 2019-12-24 11:18:13

问题


I saw this tutorial for writing a JSON-RPC server for SWI-Prolog. Unfortunately, all it does is add two numbers. I'm wondering if there exists a RPC server for SWI-Prolog that can define new rules and answer general Prolog queries, returning JSON lists, etc?


回答1:


When you take a tour on SWI-Prolog website, proudly self-powered, you can see at work some of the features offered by http package.

It's a fairly large range of tools, and to grasp the basic of the system, the easiest way it's to follow the specific How to section, step by step. There is a small bug you should be aware in the LOD Crawler: add an option on line 42 of lod.pl:

...
    ;   rdf_load(URI2, [format(xml)]),
....

or you will probably get

Internal server error

Domain error: content_type' expected, foundtext/xml;charset=UTF-8'

when running the sample.

An important feature of the IDE it's the ability to debug the HTTP requests.

When done with the HowTo, you can take a look to Cliopatria, dedicated to interfacing RDF to HTML. It come with a pirates demo, I must say I find it a bit too 'crude' for my taste, and I don't know about YUI, used in the award winning MultimediaN project. Then I've used Bootstrap to gain a modern look for the front end, with appreciable result (I'm sorry I can't - yet - publish it, need more time to engineering the system).

HTH



来源:https://stackoverflow.com/questions/11995376/does-a-json-rpc-server-exist-for-answering-general-prolog-queries

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