First, the first argument to rete.definstance() ("ds" in the example below) must match the name you give in the first argument to the (defclass) ("dimmer" in the example below.)
Second, in order to bind to an object you have definstanced, you will need to either create a defule or a defquery. I don't use defquery much but you should be able to use defrule like so:
(defrule print-dimmer-brightness
(dimmer (brightness ?b) (OBJECT ?myObj) )
=>
(printout t "brightness of object " ?myObj " is " ?b)
)
disclaimer: code above has not been checked for syntax...
alan
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, July 06, 2004 4:32 PM
> To: [EMAIL PROTECTED]
> Subject: JESS: Java bean binding and definstance
>
>
>
> Hi,
>
> I have in rules file
> (defclass dimmer DimmerSwitchDynamic)
>
> I want to create a new instance and bind that to it in java file.
>
> I am calling
> rete.definstance("ds", dimmerObject, false);
>
> in clp file I have
>
> (printout t "brightness" (call ?ds getBrightness) crlf).
>
> But I need to have
>
> (bind ?ds (new DimmerSwitchDynamic) ) in clp file
>
> This creates new instance but it prints out 0 not the one I
> set the value in definstance dimmerObject.
>
> How can I bind from Java an instance of bean to a variable
> name as in above example?
>
>
> Thanks
> Bhaskar
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>
