Hi - I am embarking on writing a graphics based program using curl language enviroment(www.curl.com). Right now this is an exercise for me to evaluate the curl language for my own interest. In doing this, I would like to transparently call ciao from the curl runtime enviroment and execute prolog programs. What might be the best approach for this.
I am running curl on my laptop, and I will host ciao on the same laptop. I am not accessing the network and I am in a single-user mode.
- what are the easiest (and most robust) ways to access ciao from curl? Socket calls from curl OK?
- Curl supports XML/SOAP, HTTP and Sockets calls. Considering performance (an important consideration), how should I format my calls from curl to ciao.
- Is there a good XML parser in ciao. From the docs alone I am not getting a clear answer. Some examples will really help.
If you can think of any other aspect that I need to consider in a problem like this please mention that also. Any and all responses are most welcome. Thanks, George
============================================================================== 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/ -----------------------------------------------------------------------------
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/ -----------------------------------------------------------------------------
Hi - thanks. The XML example is interesting and I need to study it further. I have a related question:
My understanding of Windows based development is limited but I would like to find out: Is there a way to link my win32 ciao executable via dll? Also, is it possible to have a component access API via COM? What exactly need to be done to the current ciao release to support Dll and/or COM based APIs.
Is the shared library mechanism supported, and perhaps easier to work with, on Linux?
Can you give a rough idea of the performance implications between the choices of external access via pillow/html, active module, or socket. My application will access ciao as a database, and insert new rules as well, interactively via a curl (this is equivalent to an applet) front-end.
Thanks, George
-----Original Message----- From: owner-ciao-users(a)clip.dia.fi.upm.es [mailto:owner-ciao-users(a)clip.dia.fi.upm.es]On Behalf Of Francisco Bueno Carrillo Sent: Monday, February 24, 2003 3:51 PM To: George Thomas Cc: Ciao-Users Subject: Re: searching for the best way to access ciao from curl
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/ ---------------------------------------------------------------------------- - ============================================================================== 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/ -----------------------------------------------------------------------------
Hi - thanks. The XML example is interesting and I need to study it further. I have a related question:
My understanding of Windows based development is limited but I would like to find out: Is there a way to link my win32 ciao executable via dll? Also, is it possible to have a component access API via COM? What exactly need to be done to the current ciao release to support Dll and/or COM based APIs.
Is the shared library mechanism supported, and perhaps easier to work with, on Linux?
Can you give a rough idea of the performance implications between the choices of external access via pillow/html, active module, or socket. My application will access ciao as a database, and insert new rules as well, interactively via a curl (this is equivalent to an applet) front-end.
Thanks, George
-----Original Message----- From: owner-ciao-users(a)clip.dia.fi.upm.es [mailto:owner-ciao-users(a)clip.dia.fi.upm.es]On Behalf Of Francisco Bueno Carrillo Sent: Monday, February 24, 2003 3:51 PM To: George Thomas Cc: Ciao-Users Subject: Re: searching for the best way to access ciao from curl
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/ ---------------------------------------------------------------------------- - ============================================================================== 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/ -----------------------------------------------------------------------------