[rules-users] Using JBoss Rules for implementing "sparse" lookup tables

Alexander Varakin avarakin at optonline.net
Mon Feb 19 17:40:33 EST 2007


Hi,

I am thinking of using JBoss Rules for implementing "sparse" lookup
tables, e.g. suppose I have a lookup table which contains data like this:

PostalCodeOrZIP StateOrProvince Country  DistanceFromNorthPole 
07645    NJ   USA    1200
-            NJ   USA    1100
-            -     USA    1000
-         Ontario  CA  600
-         -     CA        500

The objective is to find a best matching row in the table, given 
PostalCodeOrZIP, StateorProvince and Country and return
DistanceFromNorthPole.
Another variation is just try to find a matching row in the table and
return true if row is found.
Note that some records may have fields with omitted values, e.g. if we
know ZIP code, then we dont need to know state.
Also we may have incomplete data, e.g. for some countries there will be
only one row for the entire country, and some countries may not have any
rows.

Very important requirement is that the lookup table may grow up to 100K
rows.

It looks like this objective can be easily accomplished by translating
the lookup table  into a rule set with a rule per row in the table and
then use pattern matching of JBoss Rules for matching the rows.

My only concerns is that such implementation may consume too much
memory, considering that I will need to build ruleset with 100K rules. 
Could somebody let me know whether using JBoss Rule for this task is a
good idea and give some ideas on optimizing memory consumption. 

Thanks,
Alex





More information about the rules-users mailing list