Jess is simply saying there's no such slot in that fact. I would try
inserting a debugging print statement in the method below at the top,
something like

  System.out.println(fact);

and see what you're actually dealing with - it probably isn't what
you're expecting.


I think Weihua Zhou wrote:
> hi, there,
> 
> I just got a wired problem with jess.Fact class. In rule file, I defined
> a fact template and asserted several facts based on the template. Then
> in my java program, I was trying to get slot value as follows:
> 
>  public Task (Rete rete, Fact fact, int id) {
>   try {
>    setID(id);
>    setObject(fact.getSlotValue("object").toString());
> 
> 
>setRequirements(fact.getSlotValue("requirements").listValue(rete.getGlobalContext()));
> 
> 
> setConstraints(fact.getSlotValue("constraints").listValue(rete.getGlobalContext()));
> 
>    Hashtable h = new Hashtable();
> 
> 
>h.put("elaboration",fact.getSlotValue("elaboration").listValue(rete.getGlobalContext()));
> 
> 
> 
>h.put("dependency",fact.getSlotValue("dependency").listValue(rete.getGlobalContext()));
> 
>    setRelation(h);
>    setStatus(fact.getSlotValue("status").toString());
> 
> 
>setDuration((int)fact.getSlotValue("duration").numericValue(rete.getGlobalContext()));
> 
>    setPriority(0);
>    System.out.println("Creating task "+String.valueOf(id)+" ...");
>   }
>   catch (JessException je) {
>    System.out.println(je);
>   }
>  }
> 
> However, I always got error report from jess as "Jess reported an error
> in routine Fact.findSlot, Message: Attempt to access invalid slotname
> object." for the first time use of getSlotValue. In above case, say
> getSlotValue("object"). Did someone have the same problem before? Any
> suggestions and advice are greatly appreciated.
> 
> thanks,
> David
> 
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------

Reply via email to