Hi all,

Here is what I tried:

(deftemplate person (slot name) (multislot pets))
(deftemplate pet (slot name) (slot type))
(deftemplate neutered (slot name))

(assert (person 
(name John) 
(pets (assert (pet (name fifi) (type dog))) (assert (pet (name puss) (type cat))))))

(assert (person 
(name Fred) 
(pets (assert (pet (name fido) (type dog))) )))

(assert (neutered (name fifi)))

(defrule myrule
        ?person1 <- (person (name ?) (pets ?p1))
        ?n1 <- (neutered (name (fact-slot-value ?p1 name)))
=>
        (printout t "got here..." crlf)
        (printout t (fact-slot-value ?p1 name) crlf)
)


This gives me an error saying that (fact-slot-value ?p1 name) is an invalid slot value.

- Nik.




--- [EMAIL PROTECTED] wrote:
> I think Nik wrote:
> > Hi all,
> > 
> > That is almost what I wanted, however, I was hoping that the first matching:
> > 
> > (person (pets ?p1 ?p2 ?p3 ?p4 ?p5))
> > 
> > would bind pet facts to ?p1 through ?p5.  That way, later on in the LHS, I could do
> > something like (fact-slot-value ?p1 name) to get the values I wanted.... however,
> JESS
> > doesn't like that, it gives me a bad slot value error, when I do a batch on the 
>file
> > containing my JESS code.  I have a feeling that I have to do it the way it is
> described
> > below.  Any clarification would be most appreciated.
> > 
> > - Nik.
> > 
> 
> Well, you've still left me wondering precisely what you tried to do
> and what happened, but I can try to guess again. What you're
> describing, in general, should work fine in any version of Jess
> 6. Therefore, the problem is probably just that you're expressing it
> wrong. Remember that the things on the LHS of a rule are always
> patterns, not function calls; if you want to include a function call
> on the LHS of a rule, it has to either be part of a slot test, or part
> of a "test" conditional element. 
> 
> Anyway, you might show us what you tried and what happened, and then
> we could correct your code.
> 
> Now, I should point out that direct matching, as I've done below, will
> probably be faster and more efficient than the indirect matching using
> fact-slot-value you're proposing. There are of course special
> circumstances where you'd want to do things that way, but in general
> what I described below is simply better.
> 


=====
------------------------------------------------------

You gotta dream like you're gonna live forever,
And you gotta live like you're gonna die tomorrow...

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.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