You can do this with a single rule:
rule findHeadTail
when
ListPair( $pattern : pattern )
Document( $text : text matches $pattern )
then
System.out.println( $text );
end
where ListPair is a class maintaining two List<String> fields, heads and tails.
The getter String getPattern should return a value such as
".*(A|B|C)(X|Y|Z).*",
constructed from heads and tails.
-W
On 20 July 2010 15:10, rodih <roded.hess(a)gmail.com> wrote:
Hi,
I have the following scenario:
List 1 of string values: "A", "B", "C"
List 2 of string values: "X", "Y", "Z"
Some text that might look like "AFFG DDGT AY FDD" (Important value in the
text is AY)
I need a rule for every string value from List 1 combined with every value
from List 2 for example:
rule
when text matches "AX"
then
end rule
rule
when text matches "AY"
then
end rule
rule
when text matches "AZ"
then
end rule
rule
when text matches "BX"
then
end rule
rule
when text matches "BY"
then
end rule
...
You get the idea ;-)
The lists might be big (50 entries each) and will be change constantly out
side the application.
What is the best approach for this kind of rules?
Thanks,
Rod
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Handling-Many-Literal...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users