bob mcwhirter
Mon, 28 Jan 2002 08:20:41 -0800
> This is a new area for me ( but exciting! ).
Glad to have you on board!
> I'm experimenting with using drools for filtering datasets.
>
> In my case so far, I have basically 4 rules with varying parameters.
>
> One of the rules looks something like this:
>
> loop over a collection of beans
> - for each bean check it against the conditions.
>
> The conditions are name/value pairs with an operation ( >, <, =, etc...)
> Each name may have several values that are ORed together.
>
> So for example: return true IF name=1 OR 2 OR 3 ... etc.
Would it be possible (maybe inconvenient) to break these into multiple
rules, one for each portion of the condition?
ie;
rule-1:
name = 1
rule-2:
name = 2
rule-3:
name = 3
...etc...
> Also, each rule may have more than one name/value pair.
> And if the number of name/value pairs > 1 then AND them together
>
> Example:
>
> nameX=1 OR 2 OR 3
> AND
> nameY= A OR B OR etc...
I guess this may result in combinatorial explosion, no, using the
method I just prescribed above...
rule-1a:
nameX = 1
nameY = A
rule-1b:
nameX = 1
nameY = B
... etc ...
> Since the variable data is coming from a database and I've narrowed it down
> to 4 rules, I figured that the best approach would be to program (using the
> spi ) the rules rather than XML.
Are you doing it against all things in the database, effectively being
a query? Are you doing a SELECT * first, creating objects, and then
intending to pass them through drools?
> Can anyone give me a pointer or suggestion on how I can express the above
> using drools, especially the operators?
Thus far, I haven't allowed OR expressions in the rules-file syntax,
due to analysis complexities. Some OR expressions should/will be
allowed, but only those that result in the same 'active' objects,
regardless of which portion of the OR expression matched.
ie, this would be BAD.
if name="bob" OR age=28
This should be okay:
name="bob" OR name="billy"
Using the SPI, though, you are not limited to what I've allowed with
the rules-file analysis. You can do anything you want, including
a Condition that does OR type expressions internally.
-bob
_______________________________________________
drools-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/drools-interest