[rules-users] Rule Templates - Docs & Examples?

Adam Rinehart adam.rinehart at gmail.com
Tue Nov 24 09:42:04 EST 2009


Looking at the 5.1 snapshots, these sections have not been updated since the
5.0 release. I'm looking at a 5.1 snapshot I downloaded on 11/2/09.

The relevent sections, specifically 5.1.7 and 5.2, seem to have errors
and/or omissions and those sections should have the information I'm looking
for. Unfortunately I don't know what the correct info should be, so I can't
submit an edit myself.

As an example, from the last part of 5.1.7:
<snip>

The code to run this is simple:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
DecisionTableConfiguration dtconf =
KnowledgeBuilderFactory.newDecisionTableConfiguration();
dtconf.setInputType( DecisionTableInputType.XLS );
dtconf.setWorksheetName( "Tables_2" );
kbuilder.add( ResourceFactory.newInputStreamResource( getSpreadsheetStream() ),
              ResourceType.DTABLE,
              dtconf );

Collection<KnowlegePackage> kpkg = kbuilder.getKnowlegePackages();

We create an ExternalSpreadsheetCompiler object and use it to merge the
spreadsheet with the rules. The two integer parameters indicate the column
and row where the data actually starts - in our case column 2, row 2 (i.e.
B2)

</snip>

The docs discuss creating an ExternalSpreadsheetCompiler in the example to
merge the spreadsheet with the rules template, but the example is for a
standard DecisionTable, without a custom template.

In section 5.2, it goes over templates, but does not discussion optional
values or array values.

I have reviewed the Drools-Example files. There is an example in there of
using array values, but not an example using optional values, which is what
I particularly need.


On Tue, Nov 24, 2009 at 1:17 AM, Wolfgang Laun <wolfgang.laun at gmail.com>wrote:

> An extensive rewrite of the section dealing with Templates was done in
> the early stages of 5.0, and it ought to be available with current
> snapshot releases. The relevant section is 5.2, Templates.
>
> -W
>
>
>
>
>
>
> On 11/24/09, Adam Rinehart <adam.rinehart at gmail.com> wrote:
> > I am trying to research using a rule template driven by data from a
> > spreadsheet, rather than using a straight decision table.
> >
> > I understand I need to use the ExternalSpreadsheetCompiler but am finding
> a
> > distressing lack of information about the template format.
> >
> > The 5.0 docs seem to have mistakes; the code example for that section
> looks
> > to have been cut & pasted from another section and does not match the
> text
> > description of what is going on.
> >
> > Using google, the best I could find was a blog posting from Steven
> Williams
> > on Aug 26, 2008:
> http://blog.athico.com/2008/08/drools-rule-templates.html
> >
> > In this blog posting, he said it was the first of 3 examples from the
> > drools-examples project. But I could not find any additional blog
> postings
> > by him on this subject.
> >
> > Does anyone know of additional documentation or examples on how rule
> > templates work?
> >
> > Specifically, how to do optional columns, and array columns, similar to
> how
> > the built in decision tables feature works?
> >
> > Adam
> >
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091124/d62994c3/attachment.html 


More information about the rules-users mailing list