[rules-users] How to validate literal values on the LHS of rules.

Wolfgang Laun wolfgang.laun at gmail.com
Sun Mar 6 02:31:11 EST 2011


There is a subsection called "Rule Templates" in the Expert manual which
might
help you solve your problem. (Also, the following section on "Templates"
should
be informative.) Taking just the parameters from the XLS and supplying
either
set of rules via templates might be the best way to go.

Notice that another approach could be to create objects from the parameter
sets users create for the "first" set of rules. (Here some XLS reading would
have
to be used - see the source code in Drools.) You can (see section
"Templates")
create rules from these objects. Also, you could insert them as facts and
run simple generic rules to contrast them to another set of facts taken from
the data base, e.g.

  rule "must have article no
  when
      ParamFact( $artNo: artNo )
      not DataFact( artNo == $artNo )
  then
      // no such article number
  end

-W

On 6 March 2011 00:28, groovenarula <gnarula1 at la-z-boy.com> wrote:

> Manstis,
>
> You are correct. There are parameters that users will provide in the
> spreadsheet that I need to validate. Actually there will be one
> spreadsheet.
> It's going to serve 2 purposes. Provide a decision table AND also be a
> container of data for a few Rule Templates. The concept is that if a
> product
> does not match any criteria on the spreadsheet, then the next step is to
> extract the data from the spreadsheet and create rules where the match
> would
> be more 'generic'. So I'm planning to use the decision table to deduce the
> more 'generic matching conditions'. In both cases, I need to be able to
> validate the parameters in the spreadsheet against values in a data table.
>
> Taking my earlier example - The user might provide product attributes -
> e.g.
> product number ABC510 in the spreadsheet. I have to ensure that the ABC510
> is a valid product number before I can allow the spreadsheet to be used as
> the source of my rules (the actual rules will determine the price that will
> be charged for the product).
>
> I'll be able to easily create a new set of rules to validate the product
> information against the data table we have. That should not pose a major
> problem. The question is how to easily convert the spreadsheet into an
> arraylist of facts that I can insert into this rule set. I know I can
> 'program' this manually using POI etc. I'm looking to see if there's a less
> fragile way to load the spreadsheet as facts ? If there is a quicker way,
> I'd love to hear about it.
>
> Hope that makes more sense and is a little clearer than mud :).
>
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/How-to-validate-literal-values-on-the-LHS-of-rules-tp2638081p2639892.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> 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/20110306/ac2d56d1/attachment.html 


More information about the rules-users mailing list