A Jess list is not a java.util.List, and vice versa. An actual array becomes a multislot (list) property; a java.util.List property becomes a plain old single slot containing the java.util.List object. You can call Java methods on that List object to retrieve its elements and make various assertions about it, but you can't use multifield matching.


On May 12, 2009, at 3:06 PM, Davide Zambon wrote:

Thanks a lot for the quick and right answer! :-)

Unfortunately this seams not work properly when I try to use the multislot value like a list.
Trying to read an element of the list, Jess gives me this error:

Message: '<Java-Object:jess.aj>' is JAVA_OBJECT, not  a list.

isn't a Class-defined array still a multislot?

My class is called Relation and its multislot is called multiplicityFrom, the following line (taken from a rule) is that one that generate the error:
(Relation (name ?n) (multiplicityFrom ?a $?list))

many thanks again!
Greetings

Davide


2009/5/12 Ernest Friedman-Hill <[email protected]>
Multislots come from properties of array type -- i.e.,

private int[] ia;
public int[] getAges() { return ia; }
public void setAges(int[] ages) { ia = ages; }

Jess most definitely does *not* like working with methods that return or accept objects of type jess.Value or jess.ValueVector or their subclasses!


On May 12, 2009, at 3:56 AM, Davide Zambon wrote:

Hi Jess Users,

This is my first experience with Jess.
I declared my own template as a Java class, every (single) slot works.
But I wished also to add some multislots in my template, so I wrote:

public void setMymultislot(Value v)
   {
   }

   public Value getMymultislot()
   {
     return null;
   }

but Jess don't recognize it at all. It result with an error arguing my template has not a multislot with that name.
Where is the problem?

Many thanks in advance!

Davide Zambon

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            [email protected]
Livermore, CA 94550                             http://www.jessrules.com





--------------------------------------------------------------------
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
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







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