[net.ai] Info Wanted on YAPS

blackwel@bgsuvax.UUCP (03/29/85)

We have a new implementation of YAPS here at Bowling Green State
University. We are having problems creating and subsequently using or
making calls to a yaps-database using the flavors command
"make-instance" and the yaps command "use-yaps-db". Could someone send
us an example, the documentation isn't very clear.           

"If the problem with some people is that they think too much, why make
computers that think even more?"

Simon Blackwell
bgsuvax

liz@tove.UUCP (Liz Allen) (04/01/85)

As the author of YAPS, I'll attempt a response:
> = Simon Blackwell
>We have a new implementation of YAPS here at Bowling Green State
>University. We are having problems creating and subsequently using or
>making calls to a yaps-database using the flavors command
>"make-instance" and the yaps command "use-yaps-db". Could someone send
>us an example, the documentation isn't very clear.           

If you just want to use one yaps database (ie all your facts and
rules want to be at one place), simply define rules using "p" and
forget about the fact that you can set up more than one database.

However, if you want to use more than one yaps database, then you
might want to define a function something like this:

	(defun make-new-db nil
	  (let ((new-db (make-instance 'yaps-database)))
	       (<- new-db 'installp 'my-rule 'another-rule ...)
	       (<- new-db 'fact ...)
	       ...
	       new-db))

The call to make-instance creates an object of the flavor yaps-database.
If you want to, you can mix the flavor yaps-database into some
other flavor and do a make-instance of that flavor.  (In fact, if
you want to do that, it might make a lot of sense to take something
like the above and turn it into a :after :init for the new flavor.)

The installp method takes the names of rules defined with defp and
puts them in the new database.  (The rules could also be defined
with p, but you should only use p if you're only going to have one
database since it automatically installs the rules in whatever the
current database might be.)

The fact method adds a new fact to the database.


The function "use-yaps-db" is primarily meant for debugging when
you want to experiment with a particular database.  So, if foo is
set to a yaps database, then (use-yaps-db foo) will rebind *yaps-db*
to foo and allow you to manipulate foo using (cs), (db), etc, rather
than (<- foo 'cs), (<- foo 'db), etc.
-- 
Liz Allen    U of Maryland   ...!seismo!umcp-cs!liz   liz@tove.ARPA

"This is the message we have heard from him and declare to you:  God
 is light; in him there is no darkness at all" -- 1 John 1:5