RE: JESS: Get fact's slot value

2010-11-22 Thread John Everett
Jess is a rule language whose basic mechanism is pattern matching, which binds pattern variables to constants. If you have a fact of the form (person (name Fred) (age 22)) then you can issue a query of the form (person (name ?name) (age ?age)) and it will bind ?name to Fred and ?age to 22 (if

RE: JESS: Get fact's slot value

2010-11-22 Thread alvin0618
Could you please show me the guidance??? I'm trying to modify the ?new fact for tallying his expenses, something like this in Java code: double expense = 1000; expense = expense + 2000; // trying to get the previous amount add up with the current amount (deftemplate (slot name) (slot age)

Re: JESS: Get fact's slot value

2010-11-22 Thread Gaëtan Pruvost
Hello, I agree with John, you should take a course through the tutorials first, it would help you a lot. Now, in your question, it seems that you need to access the slot of a specific fact that you've just bound. In this case, you can access slots directly with a . (like an object field):

Re: JESS: Get fact's slot value

2010-11-22 Thread Gaëtan Pruvost
First of all, you might tell us why you don't want to use modify? I can't see any good reason for that. I think a perfectly valid notation in your case would be : (modify ?new (expense (+ 2000 ?new.expense))) Now if you're not familiar with LISP-like notation, you have a lot of guidance here: