Hi Jess,
I am facing the same problem right now. While, I do not know of any OOTB ways to do this,
I initially implemented an all rule solution.
In my case, I had a lookup table that based on a age or gender got a rate or some value.
Using some Excel Trickery, I got the 2 dimensional table into one dimensional columns of
the type:
Age Gender Value
Age and Gender became conditions and Value became the Action.
In your case, you could form a column with a dummy LHS(1=1) and keep all the columns as
Action Columns.
In each Action Column you could build up your Fact.
For Example you could do the following:
Fact{ int a; int b;
}
Condition Action Action
F: Fact
f.set($1); f.set($1)
Eval(true) Col A Col B
Dummy Value <values for a> <values for b>
If you generate a rule base out of this, it should load your tables straight as facts.
However, do note, that I did some rather Q&D benchmarks for this and soon realized
that the rulebase size and memory usage was getting really large. (Especially the PermGen
Size).
You may want to have a look at the memory usage, in case you need to load a large number
of tables. Due, to the above(and other reasons), I just wrote a custom parser using JXL
(The same Excel Library Drools uses for Parsing Excels). It is really neat and would make
a simple solution.
In, case you get another solution do post it to the list.
Cheers,
Vikrant
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Evans, Jess
Sent: Thursday, October 09, 2008 11:54 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] fact base storage?
I'm trying to come up to speed on the drools capabilities. I see that drools supports
loading rules from a decision table in a spreadsheet. I have a set of conversion tables
that I'd like to represent as facts asserted when the rule base has been loaded, but
before processing user requests. I could always model lookup tables in a database, but
I'd rather not have to build the CRUD interface to manage them. I'd rather
represent them so that each row in a spreadsheet represents a fact (based upon a
predefined java bean). Of course, I could custom implement this functionality. However,
I was wondering if drools supports some OOTB means of loading facts from Excel or other
resource?
thanks,
-Jess
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek
Limited, unless specifically indicated to that effect. Mastek Limited does not accept any
responsibility or liability for it. This e-mail and attachments (if any) transmitted with
it are confidential and/or privileged and solely for the use of the intended person or
entity to which it is addressed. Any review, re-transmission, dissemination or other use
of or taking of any action in reliance upon this information by persons or entities other
than the intended recipient is prohibited. This e-mail and its attachments have been
scanned for the presence of computer viruses. It is the responsibility of the recipient to
run the virus check on e-mails and attachments before opening them. If you have received
this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~