Thank you , works fine!
Regards Hans
Jason Morris wrote:
Yep, that works too, of course. And it is the preferred way of doing it.
My bad.
On Nov 14, 2007 1:23 PM, Robert Kirby [EMAIL PROTECTED] wrote:
How about
(defrule find_it2
(things (Id ?pId)(elements $? ?elementName $?))
Hey all!
I have a newbie question. I read the Answers to the matching in two
multislots of two different templates post.
I have very similiar problem but not the same ;-) I simplify the problem for
you:
;;Templates:
(deftemplate things
(slot Id)
(multislot elements))
(deftemplate
Hi Hans,
Try this solution:
(clear)
(watch all)
(deftemplate things
(slot Id)
(multislot elements))
(deftemplate otherthing
(slot one_Element))
(deffacts init
(things (Id 1) (elements a b c))
(otherthing (one_Element a)))
;Get all Ids of things
;Where AElement of elements
Or this one which is subtly different:
(deftemplate things (slot Id) (multislot elements))
(deftemplate otherthing (slot one_Element))
(defrule FindIt
?ot - (otherthing (one_Element ?el ))
?th - (things (Id ?Id) (elements $? ?el $?))
=
(printout t found ?el in ?Id crlf)
)
(deffacts
How about
(defrule find_it2
(things (Id ?pId)(elements $? ?elementName $?))
(otherthing (one_Element ?elementName))
=
(printout t found it: ?pId crlf))
which is described at the end of 6.4. Matching in Multislots
http://herzberg.ca.sandia.gov/jess/docs/70/rules.html#multimatch?
Bob
Yep, that works too, of course. And it is the preferred way of doing it.
My bad.
On Nov 14, 2007 1:23 PM, Robert Kirby [EMAIL PROTECTED] wrote:
How about
(defrule find_it2
(things (Id ?pId)(elements $? ?elementName $?))
(otherthing (one_Element ?elementName))
=
(printout t