Hi,

Well, this is an interesting point, I think. Jess is doing the best it
can under adverse circumstances.

As far as both Jess and Java are concerned, an empty multislot (empty
array) is quite a different thing from a null multislot (null array
reference.) The fact containing (multislot nil) is Jess's way of
representing the latter. CLIPS doesn't -have- a way of representing
the latter, because it can't happen in CLIPS. So I suppose what I've
done (by default really) is decide that null (as opposed to empty)
multifields are unmatchable. This is not an unreasonable thing. For
instance, imagine a scripting language in which Java beans appear as
objects. Can you call multislot.equals(...) when multislot itself is
null? No, of course not. Jess is just behaving the same way.

Now, I can't tell you how to write your Beans (you may not even have
written them) but I think you need to look very carefully at what this
null return value means, and how it's different from returning
a zero-length array. Note that if the method returned a zero-length
array instead of null, you could match the multifield exactly as you
expect, and everything will work just fine.

One way of dealing with this might be for Jess to automatically turn
null array references into empty multifields; but I'm not sure I like
that, since someone might want to distinguish between empty and null.


I think [EMAIL PROTECTED] wrote:
> 
> 
> 
> Hi,
> 
> Problem 1:
> 
> I'm trying to match shadow fact with multislot generated by undefined
> array.
> Java: int[] = null.
> 
> Jess 4.3 facts command displays fact in such a way:
> (fact (multislot nil))
> 
> I'm trying to match this fact with rule:
> (defrule r1
>   (fact (multislot nil))
>   =>
> but without success.
> 
> How to match unassigned multislots in shadow facts ?
> 
> 
> Problem 2:
> 
> Unassigned multislots generated by JESS or CLIPS can be matched with:
> (defrule r1
>   (fact (multislot))
>   =>
> In this case empty multifield is assigned to multislot (result of
> (create$)).
> 
> How to maintain set of such rules which will work with normal and shadow
> facts
> 
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [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. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to