Index of /knowledge-sharing/lib/unit-conversion-agent

      Name                    Last modified       Size  Description

[DIR] Parent Directory 10-Jul-1997 16:51 - [   ] communicate.lisp 04-Oct-1993 13:46 1k [   ] kapi.lisp 04-Oct-1993 13:46 4k [   ] kif.lisp 04-Oct-1993 13:46 4k [   ] kqml.lisp 04-Oct-1993 13:46 3k [   ] package.lisp 04-Oct-1993 13:46 1k [   ] physical-quantities...> 04-Oct-1993 13:46 23k [   ] standard-units-and-d..> 04-Oct-1993 13:46 9k [   ] unit-and-dim.lisp 04-Oct-1993 13:46 33k

Sept 14, 93 


AGENT UNIT-AND-DIMENSION

This agent allows a certain number of queries, operations on units and dimensions.


1. The different files included in this directory are the following :

++++ KAPI.LISP
The communication is done with kapi. The code has been written in C by eitech. They have also provided a "bridge" to lisp (which neeeded one or two modifications). Code and informations about it are in the directory "shade". The modified lispcode is in kapi.lisp (in this directory). It is thus necessary to use a Lucid Common Lisp (the version I use is the 4.1). 

++++ COMMUNICATE.LISP
An agent at eitech plays the role of the server of the network dispatching queries and answers to agents whose identities are given by their names. The lisp code allowing the connection to this server and  the start of a process listening to the network is in communicate.lisp. Make sure that the addresses of the files 

++++ KQML.LISP
The syntax for all the queries is KQML (Knowledge Query Module Language). At this time the only request possible are achieve and evaluate.
The part of the code corresponding to it is included in kqml.lisp.


++++ PACKAGE.LISP
Package.lisp includes several defintions of packages.

++++ KIF.LISP
The specification and the syntax of the operations on units and dimensions are defined in the ontology "physical-quantities". 

++++ PHYSICAL-QUANTITIES.LISP
This ontology specifies the agent : it is not actually needed to have the agent running.

++++ STANDARD-UNITS-AND--DIMENSIONS.LISP
This ontology defines standard units and dimensions : their link (kilometers in terms of meter, dimension of meter is the length-dimension ...), it is read by the agent. If other units are needed (liter or whatever) it should be added in this ontology or a new one should be created. The agent will check a few properties of the new set of units and dimensions. It will detect incompleteness : if it is unable to know the conversion of two units of the same dimension. It will also detect inconsistency : if there are several different conversions possible. 

++++ UNIT-AND-DIM.LISP
This is the core of the agent.

1- it includes the function which reads the ontology "standard-units-and-dimensions". 
It checks a few properties of the new set of units and dimensions. Mainly, it will detect incompleteness and inconsistency : if it is unable to know the conversion of two units of the same dimension and if there are several different conversions possible.

2- The file unit-and-dimensions includes definitions of functions needed for the "kif functions". (They could have been gathered in only one file, but since operations like + or - have not the same meaning in Lisp and in Kif, we have been obliged to make different packages in order to avoid confusions.)



2. running the agents.


Server and client do not need the same code (otherwise where would be the interest of doing agents?)
Obviously, the client does not need the last four files.
It is advised to change the names of the agents otherwise the eitech dispatching agent might be lost (if he has got several processes with the same name).

server :

;;; LOAD ONTOLINGUA

   (load "~htw/ontolingua/defsystem")
   (load-ontolingua)


;;; LOAD COMMUNICATION CODE

   (load "~/unit-and-dim/package.lisp")
   (in-package "COMMUNICATION")
   (load "~/unit-and-dim/communicate.lisp")
   (load "~/unit-and-dim/kqml.lisp")


;;; LOAD AGENT CODE

   (load "~/unit-and-dim/kif.lisp")
   (load "~/unit-and-dim/unit-and-dim.lisp")


;;; CONNECTION TO EITECH REGISTRAR AGENT

   (setq *myname* "asterix")
   (connect)


;;; LAUNCH PROCESS IN BACKGROUND

   (start-listening)



client :

;;; LOAD COMMUNICATION CODE

   (load "~/unit-and-dim/package.lisp")
   (in-package "COMMUNICATION")
   (load "~/unit-and-dim/communicate.lisp")
   (load "~/unit-and-dim/kqml.lisp")


;;; CONNECTION TO EITECH REGISTRAR AGENT

   (setq *myname* "obelix")
   (connect)


;;; LAUNCH PROCESS IN BACKGROUND

   (start-listening)



3. The server needs to load the ontology and to read it :
in KQML :
(achieve :receiver "asterix" :language LISP :content (load-unit-ontology))
(achieve :receiver "asterix" :language LISP :content (read-unit-theory))


4. and now speak KQML

ex :
(evaluate :receiver "asterix" :sender "obelix" :language KIF
	  :content (magnitude (* 5 meter) meter))
or
(evaluate :receiver "asterix" :language LISP :content (+ 3 4))