[rules-dev] Request help for source code of accessing excel file using Drools 5.0

Anstis, Michael (M.) manstis1 at ford.com
Wed Jun 30 07:05:37 EDT 2010


Firstly, this would be best targeted at the drools-user forum, as the
dev mailing list is the preserve of drools development itself.

Secondly, can you advise why you need to access the rules rather than
the results inferred by the rules themselves when operating on facts?

Once you have your KnowledgeBase you can retireve Rule objects using the
API, however they appear to have limited use.

Can you explain your use-case more?

-----Original Message-----
From: rules-dev-bounces at lists.jboss.org
[mailto:rules-dev-bounces at lists.jboss.org] On Behalf Of Sanjib Karmakar
Sent: 30 June 2010 09:04
To: rules-dev at lists.jboss.org
Subject: [rules-dev] Request help for source code of accessing excel
file using Drools 5.0


Hi 

I am new in drools and in my project I would like to access rules in
excel
file using drools 5.0
Please provide me the source code for how to access the rules in excel
file.

I have done the following code

KnowledgeBuilder kBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(); 
DecisionTableConfiguration dtconf =
KnowledgeBuilderFactory.newDecisionTableConfiguration(); 
dtconf.setInputType( DecisionTableInputType.XLS ); 
dtconf.setWorksheetName("Tables"); 
kBuilder.add(ResourceFactory.newFileResource("TeamAllocationExample.xls"
),
ResourceType.DTABLE, dtconf);
		
KnowledgeBuilderErrors errors = kBuilder.getErrors();
 if (errors.size() > 0) 
  {
    for (KnowledgeBuilderError error: errors) {
    System.out.println(error);
  }
  throw new IllegalArgumentException("Could not parse knowledge.");
}

KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kBuilder.getKnowledgePackages());
return kbase; 

How could I use the POJO for accessing the rule?

Please help me.

Thanks in advance
Sanjib

-- 
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Request-help-for-sou
rce-code-of-accessing-excel-file-using-Drools-5-0-tp932651p932651.html
Sent from the Drools - Dev mailing list archive at Nabble.com.
_______________________________________________
rules-dev mailing list
rules-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev



More information about the rules-dev mailing list