George Thomas writes:
- what are the easiest (and most robust) ways to access ciao from curl?
Socket calls from curl OK?
Yes. Probably sockets.
- Curl supports XML/SOAP, HTTP and Sockets calls. Considering performance
(an important consideration), how should I format my calls from curl to ciao.
If your calls are simply the Prolog terms that represent the Prolog goals that you want to execute, the traffic in the socket will be minimized.
Also, in doing that, you can use a Ciao active module as the server for the Prolog calls, making it easier at the Prolog side. You only need to send "p(X)" to the socket of the active module and it will return the answer as, e.g., "p(a)". Of course, you would have to write the curl client part, anyway.
- Is there a good XML parser in ciao. From the docs alone I am not getting a
clear answer. Some examples will really help.
The Pillow parser can do: library('pillow/html') exports a predicate xml2terms/2 to turn a XML string into a Prolog term.
Below you can find an example. It is a bit long... but XML is so verbose! ;-) and maybe difficult to parse, but bear in mind that the Prolog strings "..." have control characters within them... ;-(
Hope this helps.
Francisco Bueno -----------------------------------------------------------------------
xml2terms("<?xml version=""1.0""?> <envelope> <params index=""1""> <to> <agent-identifier > <name>nemo(a)nautilus</name> <addresses> <url>http://www.clip.dia.fi.upm.es:32323</url> </addresses> </agent-identifier> </to> <from> <agent-identifier > <name>tester01045744551669(a)paris.agentcities.net</name> <addresses> <url>http://leap.crm-paris.com:5194/leap</url> </addresses> </agent-identifier> </from> <acl-representation>fipa.acl.rep.string.std</acl-representation> <date>20030120Z133552772</date> <intended-receiver> <agent-identifier > <name>nemo(a)nautilus</name> <addresses> <url>http://www.clip.dia.fi.upm.es:32323</url> </addresses> </agent-identifier> </intended-receiver> </params> </envelope> ",Y).
Y = [xmldecl([version="1.0"])," ",env(envelope,[],[" ",env(params,[index="1"],[" ",env(to,[],[" ",env('agent-identifier',[],[" ",env(name,[],["nemo(a)nautilus"])," ",env(addresses,[],[" ",env(url,[],["http://www.clip.dia.fi.upm.es:32323"])," "])," "])," "])," ",env(from,[],[" ",env('agent-identifier',[],[" ",env(name,[],["tester01045744551669(a)paris.agentcities.net"])," ",env(addresses,[],[" ",env(url,[],["http://leap.crm-paris.com:5194/leap"])," "])," "])," "])," ",env('acl-representation',[],["fipa.acl.rep.string.std"])," ",env(date,[],["20030120Z133552772"])," ",env('intended-receiver',[],[" ",env('agent-identifier',[],[" ",env(name,[],["nemo(a)nautilus"])," ",env(addresses,[],[" ",env(url,[],["http://www.clip.dia.fi.upm.es:32323"])," "])," "])," "])," "])," "])," "] ? ============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------