I think John Goalby wrote:
> 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.
Ah, OK. I see. The backwards-chaining example in the manual uses
ordered facts, and the documentation for the function doesn't mention
that the deftemplate must be defined first. I'll amend the
manual. Sorry for your trouble.
> 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?
Looks like you're set up for using b-chaining correctly, yes, but then
you also assert an AAATable fact; because of this fact, no backwards
chaining happens, so most of this code example is moot.
>
> 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.
The first line is an example of using an "unordered" or "deftemplate"
fact, as described in manual section 2.7.2; you must define a
deftemplate before you can create facts of this type or write rules
that match them.
The second line is using an ordered fact (except for the extra close
paren after ?ONE which I think is a typo) as defined in manual section
2.7.1. This is also perfectly legal, and you don't need to define a
deftemplate for it, but they're two separate beasts, and you can't use
an ordered and an unordered fact by the same name in the same
application.
>
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
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]
---------------------------------------------------------------------