Sorry about the extra ;'s etc, I was using execute commands
and wanted to clean up for everyone.

I got the following to work:

(deftemplate AAATable (slot AAA1) (slot AAA2) (slot AAA3))
(do-backward-chaining AAATable)
(defrule AAATableFetch (need-AAATable (AAA1 ?P1) (AAA2 ?P2) (AAA3 ?P3)) => 
(assert (AAATable (AAA3 hello) (AAA1 goodbye))))
(defrule CHECKAAA (AAATable (AAA1 ?ONE) (AAA3 ?THREE)) => (printout t 
ZZZZZZZZZZz " " ?ONE " " ?THREE crlf))

If I move the (do-backward-chaining AAATable) to before the
deftemplate then I get a "bad slot value" error.  Seems to
work this way and I get the following output:

ZZZZZZZZZZz goodbye hello

Which is right.

Is this an acceptable way to do this?

My preference is to use this line:
  (defrule CHECKAAA (AAATable (AAA1 ?ONE) (AAA3 ?THREE)) => ...
over
  (defrule CHECKAAA (AAATable ?ONE) ? ?THREE)) => ...

because some of my rules have many (20+) slots.  This
way I am not order dependent.

John.

----Original Message Follows----
I can't tell what it is you're trying to do here. Aside from the fact
that the template AAATable isn't defined, this code looks more or less
OK (I'm assuming that the stray semicolon and the escaped quotes are
because this came from a series of executeCommand() calls.)

If you're trying to figure out a way to write a pattern where the name
of a slot isn't specified -- i.e., the name of the slot is a runtime
variable -- then there is no way to do that. The names of the slots
are turned into network geometry information when the rules are
compiled, and aren't sued at runtime -- so they must be present at
compile time.

If that's not it, try describing to us what it is you want to accomplish.

I think John Goalby wrote:
 > Hi
 >
 > I would like some help with using the deftemplate with rules.
 > I want to be able to specify particular slots in my rule
 > instead of having '?' placeholders.
 >
 > Here is an example (I have tried numerous variations):
 >
 > (do-backward-chaining AAATable)
 > (deftemplate AAATemplate (slot AAA1) (slot AAA2) (slot AAA3))
 > (defrule AAATableFetch (AAATemplate (AAA1 ?P1) (AAA2 ?P2) (AAA3 ?P3)) =>
 > (printout t ?P1 \" \" ?P2 \" \" ?P3))");
 >
 > (defrule CHECKAAA (AAATable (AAA1 ?ONE) (AAA3 ?THREE)) => (printout t
 > ZZZZZZZZZZz \" \" ?ONE \" \" ?THREE crlf))
 >
 > I want to be able to specify slots in CHECKAAA.  I cannot
 > work out the correct syntax as I keep getting bad slot value
 > error messages.
 >
 > I realize that AAATable is not a template but I cannot
 > figure out how to specify the template I want to use.
 >
 > Any help very appreciated.
 >
 > Thanks
 >
 > John.




---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify 
[EMAIL PROTECTED]
---------------------------------------------------------------------


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to