Did you try adding extra columns? Like:
OrderedFact(type == "GroceryList", values contains "peas", values contains
"milk");
Hello Mitch,
I ended up creating and OrderedFact Java object which contains a
String 'type' and List 'values' property.
This allows me to do things like,
rule "Create a grocery list"
when
not OrderedFact(type == "GroceryList")
then
assert(new OrderedFact("GroceryList", new String[] {"peas",
"carrots"}));
end
rule "Add milk if the list contains peas"
when
f : OrderedFact(type == "GroceryList", values contains
"peas")
eval(!f.getValues().contains("milk"))
then
f.getValues().add("milk");
end
-Mitch
PS Is there a way to avoid the eval() in the second rule?
-----Original Message-----
From: Michael Neale [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 18, 2006 5:06 PM
To: [email protected]
Subject: Re: [drools-user] Indicator (ordered) Facts
assert(new TempFact("MapExists")); something like that. You can use
TempFact over and over. If you intern the string in the TempFact
bean, then it could be pretty fast to check (as the JVM will do an
identity compare before a string char compare I think). You only need
to create it once.
On 4/19/06, Mitch Christensen <[EMAIL PROTECTED]> wrote:
Hey,
Quite often I want to work with 'temporary' facts that I often refer
to as
'indicator' facts. With Jess I used to use ordered facts for this
purpose.
In Drools, do I have to create a Java bean for every such case?
What if I wanted to do the following,
then
assert("MapExists");
end
How would I match this fact elsewhere?
-Mitch