Hi, I got the following rule:
(defrule rule1
(A ?x)
=>
(do_some_stuff))
Now I want to add the corresponding facts to the jess working Memory.
If I did it in jess, it would look like this:
(bind ?x (assert (my_fact_1)))
(assert (A ?x))
which results in
f-0 (MAIN::my_fact_1)
f-1 (MAIN::A <Fact-0>)
Now I try this in JAVA:
Fact fact1 = new Fact( "MAIN::my_fact_1", engine );
engine.assertFact( fact1 );
FactIDValue fvalue = new FactIDValue( fact1 );
Fact fact2 = new Fact( "MAIN::A", engine );
fact2.setSlotValue( "__data", fvalue );
engine.assertFact( fact2 );
This leads to the same result in the fact memory, but this time, the
rule does not fire!
If I do
int i = fact1.getFactId();
engine.assertString( "(MAIN::A (fact-id "+i+"))" );
it works again.
It seems I make a mistake when constructing the fact object, but
since I cannot see any difference in the logging output, I don't
know what went wrong.
The same problem occurs, when "my_fact_1" is a shadow fact (which is
what I want to be able to do in the end). Interestingly, f-1 then
looks like "MAIN::A <fact--0>" (two dashes). What does this mean?
Thanks for your help,
Julian Hoch
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------