File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Jess Query #2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Jess Query #2" Watch "Jess Query #2" New topic

Jess Query #2

Jonathan Goode

Joined: Dec 01, 2005
Posts: 12
I hate to be a pain but Ernest replied to my first Jess Query and then moved my post to "Other Java Products and Servers" but as far as I can see that part of the forum is rather dead and I am really anxious to get a reply from Ernest or anyone else who can help. Here is my code and what I'm hoping to do:

(deffunction under-16 ()
(printout t "How old are you?")
(assert (Patient(age (read)))))

then to modify at a later stage:

(modify 1(Patient(age (read))))
(modify 1(Patient(location (read))))

I want to create a function which asks a question such as "How old are you?" and then get Jess to compare the integer entered with the criteria specified in my rule(s). I already have a template called Patient with a slot named age. When I use the above it just gives 0. Here is my first rule:

(defrule eligibility-rule1
(Patient (age ?age& < ?age 16)))
(printout t "You are eligible for free prescriptions. (Rule: 1)" crlf) )

Thanks a million.
[ December 01, 2005: Message edited by: Jonathan Goode ]
Jonathan Goode

Joined: Dec 01, 2005
Posts: 12
Thanks very much for your help. I've managed to get it all working - just in time for my hand in date of tomorrow! Topic can be closed.
I agree. Here's the link:
subject: Jess Query #2
It's not a secret anymore!