An agent's transport is its connection to the blackboard. As such the transport provides all of the actions that an agent can initiate with the blackboard. The function provided by the agent transport are described in the following sections.
This method attempts to connect to the blackboard using the given string as the agent's name. If successful the method will return the actual name used to identify the agent.
This method is used to search the blackboard for all stored mobs that fit a given condition. The parser for the search string is dependant on the actual blackboard being used.
The default implementation in the Mica distribution includes a blackboard with an SQL back end. Searching this blackboard is done using standard SQL statements with some functional additions applicable to mobs. These functions can be used to restrict the output from the search or to order the returned mobs.
typeof(mob, 'type')
allows you to check the type of a mob. This method returns a boolean.
hasslot(mob, 'slotName')
allows you to check whether a mob has a particular slot or not.
getslot1(mob, 'slotName')
gets the first value of a slot. It returns a string.
getslot1asdbl(mob, 'slotName')
gets the first value of a slot. It returns a double.
getslot1asint(mob, 'slotName')
gets the first value of a slot. It returns an int.
getslotn(mob, 'slotName', pos)
is a useful method for getting arbitrary information from a multi-valued slot.
contains(mob, 'slotName', 'value')
allows you to check whether a mob has a particular value stored somewhere in a multi-valued slot.
Here are some example queries to help you on your way.
To get all of the mobs currently on the blackboard you can use:
select * from mobs
To find all mobs of a particular type you could try:
select * from mobs where typeof(mob, 'text')
To order the mobs you can try the order by
command. This will look like:
select * from mobs where typeof(mob, 'text') order by getslot1(mob, 'creationTime')
Appending asc
or desc
will
place the mobs in ascending and descending order respectively.
To get the most recent mob you could try:
select top 1 * from mobs order by getslot1(mob, 'creationTime') desc
Asks the transport for the name the agent is currently connected to the blackboard with.
This method is used to tell the transport who is to respond to the messages coming from the blackboard. Typically an agent transport's message handler is the agent and is set when the transport is created. So this method is often not required.
An extension of the agent transport is a synchronized transport [3]. This transport allow mobs to be used to perform remote proceedure calls(RPC) over Mica.
This method writes the given mob to the blackboard and waits for a mob to be sent in reply. A reply mob is any mob that the agent is registered for that names the original mob in its 'replyTo' slot.
The method returns an object containing the name of the written mob and the received reply. If no reply mob is received in the given time period then the returned object will have no reply.
[3] The implementation is unsw.cse.mica.sync.SynchronizedTransport
which is used by wrapping it around a standard agent transport.