Hi,

I am trying to parse this .clp file from the documentation.

(deftemplate person (slot firstname) (slot lastname) (slot age))

(defrule welcome-toddlers
"Give a special greeting to young children"
(person {age < 3})
=>
(printout t "Hello, little one!" crlf))

Here my Code:
    public static void main(String[] args) throws FileNotFoundException,
IOException, JessException {
        Rete engine = new Rete();
        FileReader file = new FileReader("M:/ikor/myrules.txt");
        Context context = engine.getGlobalContext();
        try {
            Jesp parser = new Jesp(file, engine);
            Object result = Funcall.TRUE;
            while (!result.equals(Funcall.EOF)) {
                result = parser.parseExpression(context, false);
                if (result instanceof Defrule) {
                    Defrule rule = (Defrule) result;
                    ConditionalElement ce = rule.getConditionalElements();
                    int gs = ce.getGroupSize();
                    for (int j=0;j<gs;j++) {
                        ConditionalElement e = ce.getConditionalElement(j);
                        System.out.println(e.toString());
                    }
                }
            }
        } finally {
            file.close();
        }
    }

I only get "Main:: person" .

How can I get   {age < 3}  ?

Thanks a lot

Bernd Enders


--
View this message in context: 
http://www.nabble.com/How-to-parse-the-Conditions---tp18109883p18109883.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]
--------------------------------------------------------------------

Reply via email to