Keep in mind two things:
First, when matching to a literal value in Jess, the very stringent
"eq" test is used; the items have to have the same type and the same
value, so, for instance, 1.0 doesn't match 1, because the first is a
FLOAT and the second is an INTEGER.
Second, there's no way to write a LONG literal in Jess 6.
So if you're writing a rule like
(defrule test3
?req <- (testfact (id 1) ... ) => ...)
Then you're looking for the id slot to contain the INTEGER "1", but it
doesn't -- it contains the LONG "1", which doesn't match.
Instead, you can use the "long" function to turn the literal "1" into
a LONG:
(defrule test3
?req <- (testfact (id =(long 1)) ... ) => ...)
Note that "=" before the "long" function call, it's important: it's
called a "return value constraint" and it tells Jess to assume that
the return value of the function should match the contents of the
slot.
In Jess 7 (we're getting close now!) LONG is a first-class type, and
you can write LONG literals as, for example, 1L.
I think Raoul Jarvis wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hello,
>
> I have the following problem.
> - I'm trying to call Jess from Java program.
> - I assert facts using Rete.assertFact(fact) method. The fact has an id field of
> type long, so I use f.setFlotValue("id", new LongValue(factdata.getId()).
> - Template for the fact does not specify data type for the field "id" (although
> I also tried RU.LONG).
> - Rules are are defined by constructing a string (defrule ...) and then passing
> this string to Rete.executeCommand(rulestring)
>
> Everything is accepted/parsed fine, except no activations happen. :(
> Now, when I use Integer value for the "id" slot (e.g. f.setFlotValue("id", new
> Value(element.getId(), RU.INTEGER)) activations take place and everything works
> ok.
>
> The rule defined is quite simple:
> (defrule test3
> ?req <- (testfact (id 1) ... ) => ...)
>
> So, am I overlooking something or for some reason jess cannot do matching based
> on slot values of type long ?
>
> Thank you in advance for your help,
> Raoul
>
> --------------------------------------------------------------------
> 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
Science and Engineering PSEs Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
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]
--------------------------------------------------------------------