File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Jess Query #2

Jonathan Goode
Greenhorn

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))))
etc...

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
Greenhorn

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jess Query #2
 
Similar Threads
JESS: exist and test functions
Jess Query
Jess Query
[Jess] Companion texts?
jess