There's a listFacts() method that works very me so far.
Iterator facts = engine.listFacts();
while (facts.hasNext()) {
Fact fact = (Fact)facts.next();
Deftemplate deftemplate = fact.getDeftemplate();
for (String slotName : deftemplate.getSlotNames()) {
...etc.
On Nov 26, 2010, at 2:22 AM, alvin0618 wrote:
>
> How i do retrieve the facts' values from Jess to Java? I have read some
> example, they're just using printout t for displaying the message from Jess
> instead of showing assign into a variable. Could someone can show one
> example as the condition at below.
>
> JESS part:
>
> (deftemplate person (slot firstName) (slot lastName) (slot age))
>
> (assert (person (firstName Fred) (lastName Smith) (age 19)))
>
>
> Java Part:
> public class RuleEngine {
> private Rete engine;
> private String firstName;
> private String lastName;
> private Int age;
>
> public RuleEngine() throws JessException
> {
> engine = new Rete();
> engine.batch("my_engine.clp");
>
> /* What should i do over here?????*/
> }
> }
>
>
>
> --
> View this message in context:
> http://old.nabble.com/Retrieve-Variable-from-Jess-to-Java-tp30308902p30308902.html
> Sent from the Jess mailing list archive at Nabble.com.
>
>
>
> --------------------------------------------------------------------
> 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].
> --------------------------------------------------------------------
>
Donald Paul Winston
[email protected]