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) (slot expense))
(bind ?new (assert (person (name Fred) (age 22) (expense 2000))))

Instead of using the way like this:
(modify ?new (expense 3000)) ;


John Everett-2 wrote:
> 
> 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 Fred is the only person
> in
> your database).
> 
> You can do this with a defQuery or a rule. As you're new to Jess, you
> really
> ought to work your way through some of the tutorial material available, as
> Jess (and rule engines in general) operate quite differently from
> conventional programming languages.  You can learn quite a lot from the
> Jess
> manual in a few hours of poking around.
> 
> -John
> 
> -----Original Message-----
> From: alvin0618 [mailto:alvin_ng0...@live.com] 
> Sent: Monday, November 22, 2010 9:47 AM
> To: jess-users@sandia.gov
> Subject: JESS: Get fact's slot value
> 
> 
> (deftemplate person (slot name (type STRING)) (slot age (type INTEGER)))
> 
> (bind ?new (assert (person (name Fred) (age 22))))
> 
> =================================================
> The question is how do i get the binded fact's slot value, name and age???
> Could any provide help to me~
> I'm new in JESS language
> -- 
> View this message in context:
> http://old.nabble.com/Get-fact%27s-slot-value-tp30279338p30279338.html
> Sent from the Jess mailing list archive at Nabble.com.
> 
> 
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
> in the BODY of a message to majord...@sandia.gov, NOT to the list
> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
> --------------------------------------------------------------------
> 
> 
> 
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
> in the BODY of a message to majord...@sandia.gov, NOT to the list
> (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
> --------------------------------------------------------------------
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/JESS%3A-Get-fact%27s-slot-value-tp30279357p30279651.html
Sent from the Jess mailing list archive at Nabble.com.



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------

Reply via email to