Ernest,
Bean Multislot matching now works fine, but there are still some problems.
In one of the replies to my questions, you wrote:
>I think [EMAIL PROTECTED] wrote:
>>
>>
>>
>> Hi Ernest,
>> Treating empty multislot differently than null multislot makes sense.
>> I tried matching empty multislot (zero lenght arrays) in Bean generated
>> shadow facts with:
>>
>> (defrule r1
>> (fact (multislot))
>> =>
>>
>> and it works as you described. The problem is that once it is set up, it
is
>> not easy to return it to
>> initial value ("(modify ?f (multislot (create$)))" makes no sense with
>> Beans, right ?).
>
>Actually, no, this should work fine - it sets the slot back to being an
>empty multifield.
The result I got from rule like:
(defrule test-multislots-2
?f <- (param (groups))
=>
(modify ?f (param (create$))))
is:
-------------------------------------------------
Jess> (run 1)
Wrong number of args in funcall?
java.lang.NullPointerException
at jess.reflect.ReflectFunctions.valueToObject(Compiled Code)
at jess.reflect.Call.call(Compiled Code)
at jess.reflect.Set.call(Compiled Code)
at jess.Funcall.simpleExecute(Compiled Code)
at jess.Funcall.simpleExecute(Funcall.java:395)
at jess.Modify.call(Compiled Code)
at jess.Funcall.simpleExecute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Defrule.fire(Compiled Code)
at jess.Activation.fire(Compiled Code)
at jess.Rete.run(Compiled Code)
at jess.HaltEtc.call(Funcall.java:1960)
at jess.Funcall.simpleExecute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Jesp.parseAndExecuteFuncall(Compiled Code)
at jess.Jesp.parseSexp(Compiled Code)
at jess.Jesp.parse(Compiled Code)
at jess.Main.execute(Compiled Code)
at jess.Console.execute(Console.java:49)
at jess.Console.main(Console.java:61)
Jess>
-------------------------------------------------
In this particular case "groups" is Java Bean property of type int[]. I
assume that the result of
"(create$)" is different from "null" or "new int[0]" so it doesn't work. I
expected such result and that's
why your answer is a little bit confusing to me.
This situation looks like cyclical restriction to me. I can't match null
array properties, but I can set them
to null. On the other hand I can match zero length array properties but I
can't set them back to zero
lenght once they are modified.
While I was trying to make my code run I encountered some strange problems
when trying to
execute "(clear)" command. That was after my code run fine (in this test
case rules with
"(modify ?f (multislot (create$)))" on the RHS were not fired, so there
were no exceptions). I tried
to recreate problem with some simpler code (currently my prototype has 135
rules) and only
discovered problems with modify. Do you have any idea what can cause such
behaviour ?
----------------------------------------------------
Jess> (clear)
Wrong number of args in funcall?
java.lang.ArrayIndexOutOfBoundsException: 6 >= 6
at java.util.Vector.elementAt(Compiled Code)
at jess.Rete.broadcastEvent(Compiled Code)
at jess.Rete.clear(Compiled Code)
at jess.HaltEtc.call(Compiled Code)
at jess.Funcall.simpleExecute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Jesp.parseAndExecuteFuncall(Compiled Code)
at jess.Jesp.parseSexp(Compiled Code)
at jess.Jesp.parse(Compiled Code)
at jess.Main.execute(Compiled Code)
at jess.Console.execute(Console.java:49)
at jess.Console.main(Console.java:61)
Jess> (facts)
For a total of 0 facts.
Jess> (clear)
Wrong number of args in funcall?
java.lang.ArrayIndexOutOfBoundsException: 5 >= 4
at java.util.Vector.elementAt(Compiled Code)
at jess.Rete.broadcastEvent(Compiled Code)
at jess.Rete.clear(Compiled Code)
at jess.HaltEtc.call(Compiled Code)
at jess.Funcall.simpleExecute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Funcall.execute(Compiled Code)
at jess.Jesp.parseAndExecuteFuncall(Compiled Code)
at jess.Jesp.parseSexp(Compiled Code)
at jess.Jesp.parse(Compiled Code)
at jess.Main.execute(Compiled Code)
at jess.Console.execute(Console.java:49)
at jess.Console.main(Console.java:61)
Jess> (facts)
For a total of 0 facts.
Jess> (clear)
TRUE
(facts)
For a total of 0 facts.
Jess>
------------------------------------------
Thanks in advance.
Miroslav Madecki, I/T specialist - RS/6000
Internet: [EMAIL PROTECTED]
Tel: +385-1-6308-156, Fax: +385-1-6111-119
IBM Croatia, Lastovska 23, 10000 Zagreb, Croatia
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------