[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 10:00:57 EDT 2010


No problem.
 
I'd suggest you look into KnowledgeBase's newStatefulKnowledgeSession or
newStatelessKnowledgeSession (depending upon your use-case).
 
Once you have these you can insert your POJO (Fact) objects and receive
the appropriate results (Actions).
 
I get the feeling you have not read the excellent documentation; this
would definitely assist you.
 
With kind regards,
 
Mike


________________________________

	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 13:39
	To: Rules Dev List
	Cc: Rules Dev List; rules-dev-bounces at lists.jboss.org
	Subject: Re: [rules-dev] Request help for source code of
accessing excel file using Drools 5.0
	
	

	Hi Michael 
	
	Thanks you very much for your quick reply. 
	I am sorry I could not understand the proper classification of
the forum. 
	I have already sent the request to the drools-user forum. 
	
	In fact what I wanted to mean that - 
	I am using the 'TeamAllocationExample.xls' - which is the
default example I found searching in net. 
	Here LHS and RHS portions are given - I would like to know how
could I execute the rule and get the result what is given under 'ACTION'
column? 
	
	A code snippet could help me to go forward. 
	
	Thanks again for your time and cooperation. 
	
	Regards
	Sanjib Karmakar
	SkyTech Solutions Pvt. Ltd 
	
	
	
"Anstis, Michael (M.)" <manstis1 at ford.com> 
Sent by: rules-dev-bounces at lists.jboss.org 

06/30/2010 04:35 PM 
Please respond to
Rules Dev List <rules-dev at lists.jboss.org>


To
"Rules Dev List" <rules-dev at lists.jboss.org> 
cc
Subject
Re: [rules-dev] Request help for source code of accessing excel
file using Drools 5.0

	




	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
	
	_______________________________________________
	rules-dev mailing list
	rules-dev at lists.jboss.org
	https://lists.jboss.org/mailman/listinfo/rules-dev
	
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20100630/3412efee/attachment-0001.html 


More information about the rules-dev mailing list