Greetings:

I was wondering if you had a moment for a Java/Jess question?  

If so, we are using Jess with Java, and our application passes in a JavaBean
that has the data needed to run against our rules.  The original plan was to
have Jess put the results into a ResultBean but we just can't seem to figure
out how to cast a Value object to our own custom JavaBean (i.e.,
ResultBean), therefore we are stuck with a Value object that can't be cast
into another object type.

We are guessing that this may have something to do with the
external_address, but we don't know what a "Context" is or how to use it?
The documentation is vague to us on this topic.

We used this line of code to try to get our ResultBean back out: Value
rbValue = rete.fetch("JessResults");

And after this, we tried everything we could think of to get it to be a bean
again but nothing worked.  We tried both passing in a Bean, and creating one
inside our .clp file, neither approach yielded us any success.


Below is the contents of our .clp file (reflecting our last approach):

(defglobal ?*count* = 0)
(defglobal ?*flag* = 0)
(defglobal ?*cdb* = nil)
(defglobal ?*rbean* = nil)

(set-reset-globals nil)

(defrule test-100
=>
(bind ?*rbean* (new mil.af.dtb.cabr.ResultBean))
(call ?*rbean* setvehFamily "Family2")
(call ?*rbean* setvehNumber "6450")
(bind ?antrad (fetch ANT-RAD-STATUS))
(if (neq ?antrad nil)
        then 
          (bind ?antstat (call ?antrad getvalue))
          (bind ?antnm (call ?antrad getname))
          (printout t "--name--------- " ?antnm crlf)
          (assert (input-1 ?antstat))))


(defrule compute-result-A
   (input-1 ?a&:(eq 0 (str-compare ?a "passive")))
  =>
   (call ?*rbean* setsecAssessmentAnomaly 2 )
   (call ?*rbean* setpriAA1ColorCode 1)
   (printout t "--sending assesment 2 color 1" crlf)
   (store JessResults ?*rbean* ))
   )

(defrule compute-result-A1
   (input-1 ?a&:(eq 0 (str-compare ?a "active")))
  =>
   (call ?*rbean* setsecAssessmentAnomaly 4 )
      (call ?*rbean* setpriAA1ColorCode 3)
      (printout t "--sending assesment 4 color 3" crlf)
      (store JessResults "test"))
   )


This .clp file should set the family name and the vehicle number at a
minimium.


Thanks in advance,

        Joey

*****************************************************
Senior Software Engineer, Lockheed Martin M.S.
Center For Research and Support (CERES)
    Schriever AFB, Colorado Springs, CO
(719) 567-8463, [EMAIL PROTECTED]

--------------------------------------------------------------------
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