Hi Joost,

First, the quick answer: you can make a integer out of a fact-id with
the Jess function (integer):

  (bind ?fact (call (engine) findFactByID (integer ?id)))

Second, I think you're right, this should work automatically. The
integer/fact-id data type distinction is inherited from CLIPS, and it
engenders lots of confusion there, too. If you insert the following
line:

      case RU.FACT_ID: 

at line 111 in jess/ReflectFunctions.java and recompile Jess, you
should find that it works without the (integer) call. I'll include
this change in the next release.

(reset) works with anything that can be converted to a Jess integer, which
includes fact-id's. (call), on the other hand, looks at both the Java
argument types and the Jess data types to decide what to do, and I
forgot to include an explicit conversion from fact-id to Java int here.

I think Jonker, J. wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hello folks,
> 
> I'm trying to pass a certain kind of fact as a string to one of my
> functions. But I have severe problems to get a hold on that fact. 
> As I understand it, you get a fact by using ?my-match <-
> (the-fact-you-want-to-match). 
> That works just fine, for example, for retracting that fact. 
> 
> But calling findFactByID from the Rete engine results in error: Message: No
> overloading of method 'findFactByID' in class jess.Rete I can call with
> these arguments: (call (engine) findFactByID ?my-match).
> 
> (defrule my-rule
>   ?my-match <- (foo (bar "oof"))
>   =>
>   (bind ?fact (call (engine) findFactByID ?my-match))
>   (bind ?fact-as-string (call ?fact toStringWithParens))
>   (bind ?whatever (my-function "a-string" ?fact-as-string))
>   (retract ?my-match)
> )
> 
> I wonder why retract works with ?my-match, but findFactByID won't accept
> it?! 
> 
> The handle on the fact is not a Variable or Value either (though the
> exception message tells its type is a FACT_ID): 
> ...
> (bind ?fact-id-as-int (call ?my-match factIDValue (context)))
> ...
> .I get this message if I try to call any of the methods of those classes:
> Message: Not an external address: "<Fact-17>" (type = FACT_ID).
> I need the integer 17, not this string. How should I do this?
> 
> The same problem arises when I want to use (fact-slot-value ?fact-id
> "OBJECT")...
> 
> Thanks, your help is appreciated! Kind regards, Joost
> 
> Joost Jonker
> [EMAIL PROTECTED]
> KPN Research, Leidschendam, room CD102
> visitors: St. Paulusstraat 4, 2264 XZ Leidschendam
> mail: P.O. Box 421, 2260 AK Leidschendam,
> Netherlands; + 31 (0)70 - 33 27 180
> 
> 
> 
> ---------------------------------------------------------------------
> 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  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [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 (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to