There's no reason why this shouldn't work perfectly. Does creating a
score object somehow change the person object? In any event, before
running, use "(watch all)" so that you can see what's going wrong.
I think wqyivy wrote:
> Hello,
> I want to definstance object dynamically into fact base. But error occured. For
>example,
> Class person and class score are defined respectively. Then in Jess:
>
> Jess> (defclass s score)
> Jess> (defclass p person)
> person
> Jess> (bind ?p (new person "Bob"))
> <External-Address:person>
> Jess> (definstance p ?p)
> <Fact-0>
> Jess> (facts)
> f-0 (p (class <External-Address:java.lang.Class>) (name "Bob") (serial 1.0) (O
> BJECT <External-Address:person>))
> For a total of 1 facts.
> Jess>(defrule r1
> (p (name "Bob")(serial ?t))
> =>
> (bind ?s (new score ?t))
> (definstance s ?s))
> TRUE
> Jess>(agenda)
> [Activation: r1 f-0 ; time=1 ; salience=0]
> For a total of 1 activations.
> Jess>(run)
>
> When the program executed (run) command, no output was given. I had to use ctrl+c to
>terminate this program. I just want to use (definstance) command within a rule like
>(definstance s ?s)), but it doesn't work. The reason seems that, within a rule, the
>engine didn't know the meaning of parameter s.
> How can I solve this problem? Is there anyone who can help me?
> Thanks in advance!
> Ivy
>
>
>
>
>
> -----------------------------------------
> �ҵ��������ҵ�����
> http://name.etang.com/
> ���ƶ��ţ���������ʱ�й���
> http://sms.etang.com
> ��200Ԫ�����ѵľ���
> http://ecard.etang.com/progt/index.asp?s1=1&s2=1
> ְҵ��˼¼
> http://topic.etang.com/job/index.htm
>
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------