Hi,
I am having trouble understanding why the following does not work in 4.0.4.
rule "A"
when
foo : Foo( bar == true )
then
insertLogical( new DerivedFact( "relationName", foo, Boolean.TRUE ) );
end
rule "B"
when
tuple : DerivedFact( name == "relationName" )
then
// < do something with tuple >
end
Rule A fires and adds a new DerivedFact to the working memory as a
shadow fact. Rule B then fires but name is always null in the shadow
object even though name is set in the delegate.
My main goal is to reason about an existing model that I cannot change
and without adding a lot of new elements as some sort of shadow model.
I wanted to add additional properties to the model so I tried using
Java dynamic proxies to add a new interface, which did not work as I
got ClassCastExceptions during consequence execution. I then tried
using fact templates but I get compilation errors when the compiler
cannot find the DerivedFact class. I finally just added DerivedFact as
a normal class, which is where I am now. I would really like to get
back to the original goal of adding properties to the model so that
the rules are easier to understand. For example, the above code would
then be:
rule "A"
when
foo : Foo( bar == true )
then
foo.relationName = true; // or foo.setRelationName(true);
end
rule "B"
when
foo : Foo( relationName == true )
then
// < do something with foo >
end
Any insight would be greatly appreciated.
Faron.