Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting XSB Prolog in a Server

I wanted to host XSB Prolog in a server. Can someone please tell me what the procedure is? The following git link explains how to host SWIPL on a server, but the same is not working for XSB https://github.com/SWI-Prolog/swish

Your help is greatly appreciated.

like image 984
UnderWood Avatar asked Oct 29 '22 16:10

UnderWood


1 Answers

If you want to host XSB on server, just use subprocesses to be spawned to XSB.

see the XSB Manual

spawn_process(+CmdSpec,-StreamToProc,-StreamFromProc,-ProcStderrStream,ProcId)

Spawn a new process specified by CmdSpec

One of the uses of XSB subprocesses is to create XSB servers that spawn subprocesses and control them. A spawned subprocess can be another XSB process. The following example shows one XSB process spawning another, sending it a goal to evaluate and obtaining the result:

`| ?-` spawn_process([xsb], To, From,Err,_),
     file_write(To,’assert(p(1)).’),
     file_nl(To),
     file_flush(To,_),
     file_write(To,’p(X), writeln(X).’),
     file_nl(To),
     file_flush(To,_),
     file_read_line_atom(From,XX).

`XX = 126`
`yes`
`| ?-`
"Here the parent **XSB** process sends “
`assert(p(1)).`
” and then “
`p(X), writeln(X).`
” to the spawned XSB subprocess."
"The latter evaluates the goal and prints (via “ `writeln(X)` ”) 
to its standard output..."
like image 101
Anton Danilov Avatar answered Nov 15 '22 11:11

Anton Danilov