Thanks,

Another one, if I have a fact in a variable like the goal in the last example in variable ?g.

If I use this variable as a function paramater, in the function how I can get access to its slot values ?

In a Java user function I can use the .getSlotValue, but in a Jess user function, how I can do it ?

(For example, let say I would like to do my (modify ?g (state sucess)) in a user function)

Thanks again.


From: [EMAIL PROTECTED]
Reply-To: [email protected]
To: [email protected]
Subject: Re: JESS: forall
Date: Sat, 22 Apr 2006 12:50:31 -0700 (PDT)


The "forall" CE

(forall (A) (B))

says that for every A, B matches. For example

;; Everyone owns a dog
(forall (person (name ?n)) (dog (owner ?n)))

You're saying something different: given a goal X in state nil, if
every goal Y is in state success, then modify goal X. You could write
something like

; Given goal X
?g<- (goal (name "X") (state nil))
;; There's at least one goal "Y"
(exists (goal (name "Y")))
;; All goals "Y" are in state success
(not (goal (name "Y") (state ~success)))

If there's always a goal "Y", you can omit the middle pattern.


I think Skeptic 2000 wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
>
> Hi,
>
> I tried to use the forall in this way and it doesn't work, it's a bug or I
> misunderstand how it is supposed to work ?
>
> I have a deftemplate name goal with two slot, name and state.
>
> My rule is :
>
> (defrule example
> ?g<- (goal (name "X") (state nil))
> (forall (goal (name "Y") (state sucess))
> =>
> (modify ?g (state sucess)
>
> In a few words, I put the goal "X" is in state sucess if every goal "Y" are
> in state sucess.
>
> Problem is that the 'sucess' criteria seems to not considered by the forall
> CE.
>
> Thanks for help.
>
> --------------------------------------------------------------------
> 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
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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]
--------------------------------------------------------------------


--------------------------------------------------------------------
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