You're constructing the fact incorrectly. The first argument to Fact's
contstructor is just the "head" or name of the fact -- in your case,
"R." The slot data has to be added after the construction. See manual
section 4.7. To construct an ordered fact, note that you put the data
into the slot named __data as an RU.LIST:
Fact f = new Fact("R", r);
ValueVector slot = new ValueVector();
slot.add(new Value("e", RU.ATOM));
slot.add(new Value("w", RU.ATOM));
slot.add(new Value("q", RU.ATOM));
f.setSlotValue("__data", new Value(slot, RU.LIST));
I think Concollato Raffaele wrote:
> Hi, please note this java/jess program: I want to pass a java string
> vector("nomijava") as a fact and fire the rule "regola".My vector fact
> is caught by Jess but at "run" command don't fire anything!!!!
> Why????
>
> R.
>
> import jess.*;
> import java.util.*;
> class ArrayRule {
> public static void main (String[] unused) throws JessException{
> String[] nomijava= new String[4];
> nomijava[0]="R";
> nomijava[1]="e";
> nomijava[2]="w";
> nomijava[3]="q";
>
> ValueVector nomi= new ValueVector();
> for (int i=0;i<nomijava.length;i++){
>
> nomi.add(new Value(nomijava[i],RU.ATOM));
>
> }
>
> Rete r=new Rete();
> Fact f=new Fact (nomi.toString(),r);
> r.executeCommand("(batch jess/scriptlib.clp)");
> r.executeCommand(
> "(defrule regola"+
> "(R ?x ?y ?z)"+
> "=>"+
> "(assert(R a b c )))");
> r.reset();
> r.assert (f);
> r.run();
> r.executeCommand("(facts)");
> }
> }
>
>
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------