Well, taken by itself, the Jess code doesn't define the template com_cts_bfs_tcg_bre_dto_BizObject. That definition happens in your Java code, as you said, so it's available at runtime, but the editor, left on its own to figure out your code, knows nothing about that.

This is precisely the kind of thing that "require*" is made for. Put a defclass into a file, use require* to include it, and make that file available during editing. It can be missing at runtime, and require* won't complain. But that file will provide the "hint" that the editor needs to understand your code.


On Jan 3, 2011, at 10:33 PM, debasish.da...@cognizant.com wrote:

Hi all,

Happy new year to all of you...

I need one help. I was trying the following rule example, using the Java object model, and working absolutely fine as expected...

;; ----------------------------------------------
(defrule CalcInsuranceRiskHigh
"add rule comment here."
(declare (salience 10))
  (and
   (com_cts_bfs_tcg_bre_dto_BizObject (OBJECT ?driverObj)(noOfClaims
      ?noOfClaims
    ))
   (test  (>
      ?noOfClaims
      4
    ))
  )

=>
  (call ?driverObj setInsuranceRisk "High")
 )

;; ----------------------------------------------
(defrule CalcInsuranceRiskMedium
"add rule comment here."
(declare (salience 10))
  (and
   (com_cts_bfs_tcg_bre_dto_BizObject (OBJECT ?driverObj)(noOfClaims
      ?noOfClaims
    ))
   (test  (>=
      ?noOfClaims
      2
    ))
   (test  (<=
      ?noOfClaims
      4
    ))
  )
=>
  (call ?driverObj setInsuranceRisk "Medium")
 )

Note that, I am doing the following steps from Java code, and not having anything extra inside the .clp file other than the rule (i.e. defrule).
  a.) Adding the Java class () to engine classpath,
       Rete engine = new Rete();
       engine.reset();
engine.defclass("com_cts_bfs_tcg_bre_dto_BizObject", "com.cts.bfs.tcg.bre.dto.BizObject", null);

b.) Creating the fact in working memory by providing the Java object (com.cts.bfs.tcg.bre.dto.BizObject) engine.definstance("com_cts_bfs_tcg_bre_dto_BizObject", bizObject, true, engine.getGlobalContext());

  c.) Load and fire the rules.
       engine.batch("CalculateGrade.clp");
       engine.run();

Issue is while I am opening the rule in Eclipse editor (installed with JESS Eclipse plugin). The ERROR (Red Cross Mark in the left side of editor) is showing at (OBJECT ?driverObj) definition in Editor as follows -

Undefined function or construct at token 'age'
No such slot OBJECT in template MAIN::com_cts_bfs_tcg_bre_dto_BizObject at token 'OBJECT'
No such variable driverObj
Expected a '(', constant, or global variable at token ')'

Could anyone please tell me, what might be the issue? Is there something, which I am still missing in order to comply with Jess Eclipse editor standard, although not creating any issue during rule firing time? I am using the JESS 7.1.0 evaluation version.


Regards

DEBASISH DALUI (122816)
----------------------------------------------
Cognizant Technology Solutions US Corp
Cell  : +1-216-835-2902
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------

Reply via email to