HI All,

 

I want to give the tag name in defclass construct in rule file dynamically

I defined the names to be used for each kind of facts in a Constatnts class (RuleEngineConstants) - all as public static final strings.

 

So instead of following:

(defclass alertdefinition com.foo.MyClass)

 

I want to use it like

(defclass (get-member RuleEngineConstants “ALERT_DEF_NAME”) com.foo.MyClass)

 

Also in the futher deftemplates like following:

 

(deftemplate PassThrough_AlertDefDetails

    "Template for pass through alert definition details."

    (slot alertdefinition (type OBJECT)))

 

I want to use it like

(deftemplate PassThrough_AlertDefDetails

    "Template for pass through alert definition details."

    (slot (get-member RuleEngineConstants "ALERT_DEFINITION_FACT") (type OBJECT)))

 

I have all the required imports in the rule file.

I am getting an error as bad slot name.

Is there any way to give the tag name in defclass & Deftemplate constructs dynamically in the rule file only (Not from java)?

 

Following is the error stack trace for your reference:

 

Jess reported an error in routine Jesp.parseDeftemplate.

  Message: Bad slot name .

  Program text: ( deftemplate PassThrough_AlertDefDetails "Template for pass through alert definition details." ( slot (  at line 307.

      at jess.Jesp.parseError(Jesp.java:1622)

      at jess.Jesp.parseDeftemplate(Jesp.java:791)

      at jess.Jesp.parseSexp(Jesp.java:158)

      at jess.Jesp.parse(Jesp.java:69)

      at jess.Rete.executeCommand(Rete.java:1413)

      at jess.Rete.executeCommand(Rete.java:1397)

      at com.uprr.app.aaa.business.rule.engine.PassThroughPatternRuleTest.testLoadRules(PassThroughPatternRuleTest.java:112)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source)

      at junit.framework.TestCase.runTest(TestCase.java:154)

      at junit.framework.TestCase.runBare(TestCase.java:127)

      at junit.framework.TestResult$1.protect(TestResult.java:106)

      at junit.framework.TestResult.runProtected(TestResult.java:124)

      at junit.framework.TestResult.run(TestResult.java:109)

      at junit.framework.TestCase.run(TestCase.java:118)

      at junit.framework.TestSuite.runTest(TestSuite.java:208)

      at junit.framework.TestSuite.run(TestSuite.java:203)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)

      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

 

Thanks in advance.

 

Subrahmanyam

 

 

Reply via email to