Its aim is to provide high-level communication between processes and is
based on Prolog technology.
All messages are Prolog term strings.
The Pedro server allows connections from clients.
Clients can subscribe by sending a string of the form
subscribe(Term, Goal, Rock)
to the Pedro server.
Term is a Prolog term, Goal is a restricted Prolog goal and Rock is a
number that is for the clients use.
E.G. subscribe(data(L), (member(height = H, L), H > 1000), 0)
If a client sends a notification term T to the server and the goal
T = Term, Goal
succeeds, then the server forwards the message on to the clients with
matching subscriptions (attaching the rock for that client).
EG the client notification
data([height = 2000, width = 1000])
with match the above subscription
Clients can also register a name with the server and can then send
peer-to-peer messages to other registered clients using the 'handle' of
a client
Handles are of the form process_name@machine_name or
id:process_name@machine_name
In the second case the id is like the rock - it is used by the client.
We have been using Pedro to support agent programming in Qu-Prolog for a
while now. In Qu-Prolog the id in a handle is the name of a thread.
Pedro comes with APIs for C, Python and Java so you can, for example,
write a visualization/environment in Python and have other processes
interacting with it.
Pedro is available from
http://www.itee.uq.edu.au/~pjr/HomePages/PedroHome.html
The user documentation is readable from the page.
Attached is a simple example of one way to use Pedro with SWI-Prolog.
Note that this simple example does not take advantage of SWI features
like message buffers or threads.
Peter Robinson