Hi Vlad,

I can certainly look at adding some extra config options to the listeners to allow an end row/column to be specified. I'm not sure the other things would be useful to many people (correct me if I'm wrong).

If you do go down the preprocessing option you could use JXL instead of POI as you will already have a dependency on it for the drools decision table stuff. I'm not sure why we changed from POI to JXL but I have found it very easy to use.

cheers
Steve

On 2/21/07, Olenin, Vladimir (MOH) <Vladimir.Olenin@moh.gov.on.ca> wrote:

Hi, Steve.

 

That might help, though will require one 'external' run over the spreadsheet (ie, open Excel through POI and read some column with rule template names) or a separate config file which matches rules with appropriate templates. Regarding the ExternalSheetListener constructor, is there a way to set the number of records to read? From what I see (the API call), the l1 will process the same data as l2 does (when the compiler will get to row '30') and the data for the second template might not be very applicable for the first template. Basically, the thing is starting from row 30 the data merged with template 1 might generate invalid rules which is not desirable. Any way to avoid it?

 

The main reason such functionality is required in the first place (in our project at least) is that for some use cases the same data can mean slightly different things and should result in slightly different rules. The number of such 'groups' is quite large to split the 'rule data' into separate spreadsheets and the differences between the data interpretation are quite significant for coming up with some 'generic' data format (which could suit all rule 'groups'). There is definitely a bunch of workarounds that can be done, but most of them would require Excel spreadsheet preprocessing.

 

Within the existing API (from the example you attached) Excel preprocessing might be the easiest thing to do. Unless there is some more low level API which allows to insert 'interceptor' which would monitor each record that is being read by compiler and create new listener if appropriate entry is found in the particular column (eg, one column in the spreadsheet might have template name entry which remains the same for all records below unless changed to a new value)….. Smth along those lines J .

 

 

Thanks, Steve.

 

Vlad

 


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven Williams
Sent: 19 February 2007 18:54


To: Rules Users List
Subject: Re: [rules-users] conditional insert of 'exist' or 'not' keywords in decision table s

 

Hi Vlad,

There is a very basic wiki page on it (http://wiki.jboss.org/wiki/Wiki.jsp?page=DecisionTableTemplates ).

In terms of the functionality you mention you have your data having knowledge of the rule templates whereas the current implementation is such that the data has no knowledge of the templates. You can apply multiple rule templates to the same data however (as in ExternalSpreadsheetCompilerIntegrationTest):

        final ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
        final List listeners = new ArrayList();
        ExternalSheetListener l1 = new ExternalSheetListener(10, 3, "/templates/test_pricing1.drl");
        listeners.add(l1);
        ExternalSheetListener l2 = new ExternalSheetListener(30, 3, "/templates/test_pricing2.drl");
        listeners.add(l2);
        converter.compile("/data/ExamplePolicyPricing.xls", InputType.XLS, listeners);

This example assumes two sets of data in the one sheet, however they could both have been applied to the same set (ie. the second listener could also point to row 10, column 3). Would that accomplish what you need?

Steve


On 2/20/07, Olenin, Vladimir (MOH) < Vladimir.Olenin@moh.gov.on.ca > wrote:

Thanks, Steve. That really seems to do the trick. Are there any wiki pages on this new functionality? Or for now one should refer to the source code & unit tests?

 

I also wonder what other functionality the new templating engine has? Is it possible to define different 'types' of rules in the same 'rule' template and refer to these types from 'Excel' data fields (eg, have one column per rule where you can refer 'rule template XXX' from drl file; this value can override some default value for example). If not, how such situations can be handled? (ie, when one needs several type of rules driven by the same data?)

 

Thanks,

 

Vlad


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven Williams
Sent: 17 February 2007 04:25
To: Rules Users List
Subject: Re: [rules-users] conditional insert of 'exist' or 'not' keywords in decision table s

 

Hi Vlad,

With the new decision table handling you could use the following template to do it:

Given a table as follows:

exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive

the following template does what you want:

template header
driver[]
policy[]

package This_is_a_ruleset;
#generated from Decision Table
import example.model.Driver;
import example.model.Policy ;

template "Driver policy"
driver
policy

rule "driver policy $row.rowNumber$"
    when
        $driver0$
        Driver(age >= $driver1$, age <= $driver2$)
        $policy0$
        Policy(type = "$policy1$")
then
    //do smth
end
end template

the code to call it was:
    public void testColumnKeywords() {
        final ExternalSpreadsheetCompiler converter = new ExternalSpreadsheetCompiler();
        final String drl = converter.compile( "/data/TestWorkbook.xls", "/templates/test_keywords.drl",
                                              InputType.XLS, 1, 1 ); // DT starts at Row 1, Column 1
        System.out.println(drl);
    }

cheers
Steve

On 2/17/07, Olenin, Vladimir (MOH) < Vladimir.Olenin@moh.gov.on.ca> wrote:

Hi,

 

I wonder if it's possible to pass some Column keywords as parameters from template values, eg:

 

Condition

Condition

$1 Driver

$1 Policy

age >= $2, age <= $3

type

exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive

 

I'd expect the above table would generate two rules like:

 

Rule 1

When

            exists Driver (age >= 21, age <= 25)

            Policy(type == "comprehensive")

Then

            // do smth

End

 

 

Rule 2

When

            not Driver (age >= 64, age <= 100)

            exists Policy (type == "comprehensive")

then

            // do smth

End

 

 

 

The above example is just a mock up derived from one of the examples in the documentation to demonstrate the point (meaning, the rules themselves might not make sense from business point of view or can be implemented differently for this particular case).

 

So, any way to achieve this? Whether in current version (3.0.x) or the upcoming release (3.2)

 

Thanks,

 

Vlad


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference