JESS: assertFact() and java.lang.String

"kartik tadanki" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <1126_1289343122_oA9MmfJC001136_AANLkTinkBu5mezJ5quAi+LQtM8pNEswixXY1YAWP9jhs@mail.gmail.com>
Hi,

Question How can I use Value object to put in simple strings instead of
java.lang.String instances.?

-I wish to be able to assert facts from Java such that the rules in the
knowledge base can apply to them.
-Currently, I use assertString().
-When I use assertFact() the rules do not apply to the fact as with
assertString()
This is because the slot values are now java.lang.String instances.

How can I avoid building the string for assertString() and use assertFact()
such that the rules
process facts thus asserted?


My code:
=============================================
// (deftemplate Authorization (slot subject ) (slot predicate) (slot
object))

//create fact
Fact fact = new Fact("Authorization", r);

set values
Value va = new Value("a");
fact.setSlotValue("subject", va);
Value vb = new Value("b");
fact.setSlotValue("predicate", vb);
Value vc = new Value("c");
fact.setSlotValue("object", vc);

//assert the fact
rete.assertFact(fact);

// this retractString has no effect.
rete.retractString("(Authorization (subject a) (object c) (predicate b))");
=============================================


Thank you,
-Kartik Tadanki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.