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 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" Watch "Jess Query" New topic

Jess Query

Jonathan Goode

Joined: Dec 01, 2005
Posts: 12
Basically I wondered if someone could help me with a problem I have as I'm new to Jess and unsure of what to do - as a University assessment I must implement a set of rules (listed on this site using Jess. So far I'm doing Ok and have written my rules but when it comes to creating a function which asks a question such as "How old are you?" and then getting Jess to compare the integer entered with the criteria specified in my rule(s) I'm stumped. I've tried using (assert (age (read))) where age is specified in a template then linking to the rule with phase but to no avail. Here is my first rule:
(defrule eligibility-rule1
(Patient (rule ?rule) (age ?age& < ?age 16)))
(printout t "You are eligible for free prescriptions. (Rule: " ?rule ")" crlf) )

Here is the beginning of my first function:
(deffunction under-16 ()
(printout t "How old are you?")
(assert (age (read))))

Hopefully I'm making sense. Thanks in advance.

[ December 01, 2005: Message edited by: Jonathan Goode ]

[ December 01, 2005: Message edited by: Jonathan Goode ]
[ December 01, 2005: Message edited by: Jonathan Goode ]
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

Let's go talk about this in the Other Java Products and Servers forum. I'm going to move this thread there; come find it and we'll continue the discussion.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Jess Query
It's not a secret anymore!