I'm calling a java function to insert a fact (created in jess script using
assert) into a multislot, however I get the following message "Not a vector
type: "nil" JessHelper: insertFactToMultislot"
In the example below I'm basically adding an ancestor of type Human template
to a multislot field.
Thanks in advance for the help.
JessScript
-----------
(deftemplate Human
(slot Name (type STRING))
(multislot Ancestors))
(assert (Human (Name "a")
(Ancestors (assert (Human (Name "b")))(assert (Human (Name "c"))))
))
(defrule addToMS
"add to multislot"
?fact <- (Human (Name "a"))
=>
(call ?jessHelper insertFactToMultislot ?fact Ancestors (assert (Human (Name
"d"))))
)
java function
--------------
public void insertFactToMultislot(Fact fact,String multislotName,Fact
factValue)
{
try
{
Value value=fact.getSlotValue(multislotName);
ValueVector vecValue =value.listValue(engine.getGlobalContext());
vecValue.add(new Value(factValue,RU.FACT));
}
catch (JessException e)
{
System.out.println(e.getMessage() + " JessHelper:
insertFactToMultislot");
}
}
--------------------------------------------------------------------
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]
--------------------------------------------------------------------