Bug 1294832 - Unable to create knowledge base with Rule Templates
Unable to create knowledge base with Rule Templates
Status: CLOSED NOTABUG
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
6.3.0
Unspecified Unspecified
high Severity high
: ---
: ---
Assigned To: Mario Fusco
Marek Winkler
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-30 09:57 EST by Kamlesh
Modified: 2016-01-18 04:54 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-01-18 04:54:59 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Modified XLS file (10.50 KB, application/x-ole-storage)
2016-01-11 08:04 EST, manstis
no flags Details

  None (edit)
Description Kamlesh 2015-12-30 09:57:48 EST
Description of problem: i'm trying to create a kmodule.xml file to load a decision table with rule template. I'm using the Drools example of rule templates loaded in a knowledgebase named DTableWithTemplateKB with kmodule.xml taken from the example.
https://github.com/droolsjbpm/drools/blob/master/drools-examples/src/main/resources/META-INF/kmodule.xml

In this example, the ExamplePolicyPricing.xls contains both data and RuleTable. The main purpose of Rule Templates is to provide a clean separation of data from the rule. Hence I've removed all content from the xls file except the data. When I do that, I'm getting an error that my xls file doesn't contain the RuleTable. Because I'm using rule template, drools should not expect the RuleTable in xls file.


Rule templates:
http://docs.jboss.org/drools/release/6.3.0.Final/drools-docs/html/ch06.html#d0e5930

Version-Release number of selected component (if applicable):


How reproducible: Consistently with Drools 6.3


Steps to Reproduce:
1. Change the decision table excel to contain only data (Cell B9:H21)
drools-examples/src/main/resources/org/drools/examples/decisiontable/ExamplePolicyPricing.xls

2. Modify DTableWithTemplateKB entry in kmodule.xml file in drools-examples/src/main/resources/META-INF/kmodule.xml with row="2" col="1"
3.Run the PricingRuleTemplateExample

Actual results: 
Exception in thread "main" org.drools.template.parser.DecisionTableParseException: No RuleTable cells in spreadsheet.
	at org.drools.decisiontable.parser.DefaultRuleSheetListener.getRuleSet(DefaultRuleSheetListener.java:139)
	at org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:94)
	at org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:72)
	at org.drools.decisiontable.DecisionTableProviderImpl.compileStream(DecisionTableProviderImpl.java:75)


Expected results: Rule should be loaded properly 


Additional info:
Comment 2 manstis 2016-01-11 08:03:34 EST
There is a "Template" example under: https://github.com/droolsjbpm/drools/blob/master/drools-examples/src/main/java/org/drools/examples/templates/SimpleRuleTemplateExample.java

That said, I also tried modifying the "DTableWithTemplateKS" example (https://github.com/droolsjbpm/drools/blob/master/drools-examples/src/main/java/org/drools/examples/decisiontable/PricingRuleTemplateExample.java) as follows:-

kmodule.xml
-----------
    <kbase name="DTableWithTemplateKB" packages="org.drools.examples.decisiontable">
        <ruleTemplate dtable="org/drools/examples/decisiontable/ExamplePolicyPricing.xls"
                      template="org/drools/examples/decisiontable/BasePricing.drt"
                      row="3" col="3"/>
        <ruleTemplate dtable="org/drools/examples/decisiontable/ExamplePolicyPricing.xls"
                      template="org/drools/examples/decisiontable/PromotionalPricing.drt"
                      row="19" col="3"/>
        <ksession name="DTableWithTemplateKS"/>
    </kbase>

Modified XLS file is also attached.

This also worked fine.
Comment 3 manstis 2016-01-11 08:04 EST
Created attachment 1113610 [details]
Modified XLS file
Comment 4 manstis 2016-01-11 08:04:54 EST
re: comment#2, can you provide a failing unit test demonstrating the issue as I am unable to reproduce. Thanks.
Comment 5 Mario Fusco 2016-01-11 08:11:43 EST
Can you please check what reported by Michael and eventually send a reproducer of the problem if it still doesn't work for you?
Comment 7 Kamlesh 2016-01-12 09:01:01 EST
(In reply to Mario Fusco from comment #5)
> Can you please check what reported by Michael and eventually send a
> reproducer of the problem if it still doesn't work for you?

I tried it with the spreadsheet and kmodule xml from your message and I'm getting the same error. Can you please confirm if your test was done with Drools 6.3?
Comment 8 Mario Fusco 2016-01-12 13:07:59 EST
I just merged on master the pull request sent by Michael ( https://github.com/droolsjbpm/drools/pull/597/files ) that updates the example as you described. Please let me know if this is what you meant and if it works for you.
Comment 9 Kamlesh 2016-01-18 03:02:45 EST
(In reply to Mario Fusco from comment #8)
> I just merged on master the pull request sent by Michael (
> https://github.com/droolsjbpm/drools/pull/597/files ) that updates the
> example as you described. Please let me know if this is what you meant and
> if it works for you.

I'm able to get it working. The problem was in dev environment with another rule excel in the  class path. Sorry for false alarm. please close.

Note You need to log in before you can comment on or make changes to this bug.