Would you please send your final file that works in an email as you did with the original. It looks like a good example and I dont understand what you did with the "". Bob Garvey
----- Original Message ----- From: "Abdul Gaffar" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, May 10, 2002 12:18 PM Subject: Re: JESS: JESS BUG > Thank u thank u thank u thank u thank u!!!!! its works!!! hooooray!!! thank > u thank u!!!!! I cant believe it was such a simple problem.. I changed all > the readlines to read and removed all "".. Thanks again..! > > > >From: [EMAIL PROTECTED] > >Reply-To: [EMAIL PROTECTED] > >To: [EMAIL PROTECTED] > >Subject: Re: JESS: JESS BUG > >Date: Fri, 10 May 2002 09:58:14 -0700 (PDT) > > > >Hi, > > > >Well, I just misspoke; you'll have the same problem, for the same > >reason, if you use (batch), because the newline after you type (batch) > >will be eaten by the first readline. Put the script into a file, then > >start Jess as "java jess.Main file.clp" and your problem will not > >occur. > > > >Alternately, simply don't use "readline" to read single tokens. Use > >(read) -- that's what it's for. > > > >I think Abdul Gaffar wrote: > > > Hi, > > > I have got all my rules in a seperate .clp file and not entering them in > >the > > > Jess> prompt. Im using the Batch command to execute them. So I dont > >think > > > theres any interference. But that still doesnt really answer my > >question. I > > > still cannot pinpoint the cause of this I/O (readline) conflict. I've > >tried > > > running examples from Mark Watsons Intelligent Java application which is > >to > > > be run under Jess. I have the same problem as I do with my program. To > >make > > > my point clearer, here is my simple code...Note that the cause of the > > > problem is the startup rule at the bottom. The rest of the rules work > >fine. > > > ******************* > > > > > > (deftemplate goal > > > (slot type) > > > (slot value (default N)) ;; N for No, Y for Yes > > > (slot value2 (default n))) ;; 1 for whole testes 2 for lump on teste > > > > > > (defrule handle_swelling > > > ?fact1 <-(goal (type swelling) (value "Y"));; (value "y")) > > > => > > > (printout t " " crlf) > > > (printout t "Swelling can be caused by several factors " crlf) > > > (printout t "so you shoudnlt worry too much yet! " crlf) > > > > > > (printout t "As for the swelling, can u feel a specific lump?" crlf) > > > (printout t "(Yes or No) " crlf) > > > (assert (goal (type lump_present) (value (readline))))) > > > > > > > > > (defrule handle_lump > > > ?fact1 <-(goal (type lump_present)(value "Y")) > > > => > > > (printout t "Since you have said that u can feel the lump " crlf) > > > (printout t "I need to know whether u can feel above the " crlf) > > > (printout t "Lump ? (Y or No) " crlf) > > > (assert (goal (type above_lump)(value (readline))))) > > > > > > > > > (defrule handle_hernia > > > ?fact1 <- (goal (type above_lump)(value "N")) > > > => > > > (printout t "It seems like your diagnosis is that of " crlf) > > > (printout t "Inguinoscrotal Hernia.. CHECK UR DR ASAP! " crlf)) > > > > > > (defrule handle_pain > > > ?fact1 <- (goal (type above_lump)(value "Y")) > > > => > > > (printout t "Another question. This may seem obvious but " crlf) > > > (printout t "do you feel any pain? (Y or N): " crlf) > > > (assert (goal (type pain)(value (readline))))) > > > > > > (defrule handle_nopain > > > ?fact1 <- (goal (type pain)(value "N")) > > > => > > > (printout t " " crlf) > > > (printout t "It is possible that you have an illness as " crlf) > > > (printout t "certain illnesses do not exhibit painful " crlf) > > > (printout t "symptoms. Carry on with the diagnosis " crlf) > > > (printout t "to find out if you do have an illness " crlf) > > > (assert (goal (type pain)(value "Y")))) > > > > > > (defrule handle_location > > > ?fact1 <- (goal (type pain)(value "Y")) > > > => > > > (watch facts) > > > (printout t " " crlf) > > > (printout t "Now that we have estalished that you may or " crlf) > > > (printout t "may not be experiencing pain and " crlf) > > > ;;(assert (goal (type above_lump)(value "Y"))) > > > (printout t "you have the symptoms of an known illness" ?fact1 crlf) > > > (printout t "Now we need to acertain which particular illness u have" > >crlf) > > > (printout t " " crlf) > > > (printout t "Do you feel a lump on ur actual testicle? (Y or N)" crlf) > > > (assert (goal (type testes)(value (readline))))) > > > > > > (defrule handle_epid_or_elsewhere > > > ?fact1 <- (goal (type testes)(value "N")) > > > => > > > (printout t "If you dont have a swelling around ur testicle then it must > >be > > > " crlf) > > > (printout t "either on ur Epididimus or elsewhere " crlf) > > > (printout t "Do you feel a hard lump or stringlike feature ? " crlf) > > > (printout t "Answer 1 for hard lump or stringlike " crlf) > > > (printout t "Answer 2 for soft swelling " crlf) > > > (assert (goal (type hard)(value (readline))))) > > > > > > (defrule handle_elsewhere > > > ?fact1 <- (goal (type hard) (value "2")) > > > => > > > (printout t "Since the lump appears to be soft, is seems to me " > >crlf) > > > (printout t "that you may have Hydrocoele. To confirm i need to kno " > >crlf) > > > (printout t "wether the lump is transluminous ? Y or N " crlf) > > > (assert (goal (type transluminous) (value (readline))))) > > > > > > (defrule handle_hydrocoele > > > ?fact2 <- (goal (type transluminous)(value "Y")) > > > => > > > (printout t "The symptoms indicate that you have HYDROCOELE " > >crlf) > > > (printout t "********* END OF DIAGNOSIS *********** " > >crlf)) > > > > > > (defrule handle_testes > > > ?fact1 <- (goal (type testes)(value "Y")) > > > => > > > (unwatch facts) > > > (printout t "You say you feel a swelling in your testicle does " crlf) > > > (printout t "that mean that your whole testicle is swollen or " crlf) > > > (printout t "that there is a lump upon your testicle? " crlf) > > > (printout t " " crlf) > > > (printout t "Answer 1 for whole testes is swollen or " crlf) > > > (printout t "Answer 2 for lump on the actual testicle " crlf) > > > (assert (goal (type actual_lump)(value (readline))))) > > > > > > (defrule handle_TC > > > ?fact1 <-(goal (type actual_lump)(value "2")) > > > => > > > (printout t "Since your can feel an actual lump on ur testes " crlf) > > > (printout t "I can conclude that you have testicular cancer " crlf) > > > (printout t "****** END OF DIAGNOSIS ********* " crlf)) > > > > > > (defrule handle_orchitis > > > ?fact1 <-(goal (type actual_lump)(value "1")) > > > => > > > (printout t "Since you say that your whole testes is swollen " crlf) > > > (printout t "I can conclude that you have Inguinoscrotal Hernia " crlf) > > > (printout t "***** END OF DIAGNOSIS ******** " crlf)) > > > > > > (defrule handle_Cyst_or_Epid > > > ?fact1 <- (goal (type hard)(value "1")) > > > => > > > (printout t "Since u say that the lump or swelling is hard or stringlike > > > " crlf) > > > (printout t "I can conclude that you have symptoms for " crlf) > > > (printout t "Epididymitis or Epididymal Cyst " crlf) > > > (printout t "Now I need to distnguish! I need differentiate whether its > > > stringlike " crlf) > > > (printout t "or if its hard and beady? ( (Y) if it is stringlike else > >(N)): > > > " crlf) > > > > > > (printout t "******** Contine till last question ********* " crlf) > > > (assert (goal (type stringlike) (value (readline))))) > > > > > > (defrule handle_stringlike > > > ?fact1 <- (goal (type stringlike)(value "Y")) > > > => > > > (printout t "Since you say the swelling is stringlike and not on ur > >testes " > > > crlf) > > > (printout t "I can conclude that you have EPIDIDYMITIS " crlf) > > > (printout t "********** END OF DIAGNOSIS ********** " crlf)) > > > > > > (defrule handle_hardnbeady > > > ?fact1 <- (goal (type stringlike)(value "N")) > > > => > > > (printout t "Now that I know you have had all the symptoms that relate > >to " > > > crlf) > > > (printout t "confirmation that you are experiencing " crlf) > > > (printout t "EPIDIDYMAL CYST " crlf) > > > (printout t "********* END OF DIAGNOSIS ********** " crlf)) > > > > > > (defrule res_of_injury > > > ?fact1 <- (goal (type injury) (value "Y")) > > > => > > > (printout t " " crlf) > > > (printout t "Due to injury, you may have several symptoms "crlf) > > > (printout t "that may or may not be due to the prescence of a" crlf) > > > (printout t "severe illness. Carry on with the diagnosis to " crlf) > > > (printout t "see if you have any major concerns. " crlf) > > > (modify ?fact1 (value being_treated)) > > > (assert (goal (type swelling)(value "Y")))) > > > > > > > > > (defrule consult_doctor > > > ?fact1 <- (goal (type lump_present)(value "N")) > > > ;;?fact2 <- (goal (type transluminous)(value "N")) > > > => > > > (printout t "You need to CONSULT a DOCTOR " crlf)) > > > > > > > > > (defrule startup "define initial WME's created by (reset) " > > > => > > > (printout t "Welcome to the diagnosis program " crlf) > > > (printout t "The system will ask you a series of questions " crlf) > > > (printout t "to which you need to answer Y or N " crlf) > > > > > > (printout t "Have you experience any swelling ? (Y or N): ") > > > (assert (goal > > > (type swelling) > > > (value (readline)))) > > > > > > (printout t "Have you been injured recently ? (Y or N): ") > > > (assert (goal > > > (type injury) > > > (value (readline))))) > > > ************************************************* > > > Your help is very much appreciated! > > > > > > > > > >From: [EMAIL PROTECTED] > > > >Reply-To: [EMAIL PROTECTED] > > > >To: [EMAIL PROTECTED] > > > >Subject: Re: JESS: JESS BUG > > > >Date: Fri, 10 May 2002 08:42:36 -0700 (PDT) > > > > > > > >Hi, > > > > > > > >First, let me point out that I long ago stopped making any claims that > > > >Jess was a workalike for CLIPS. In general, things like I/O do work > > > >differently. > > > > > > > >I'm assuming that you're actually typing these rules in at the Jess> > > > >prompt (using either jess.Main or jess.Console), That's important, > > > >because what's happening is that both the code and the runtime input > > > >are coming from the same place; that's the only case where this > > > >matters. > > > > > > > >The problem is that when you type > > > > > > > >Jess> (run)<Enter> > > > > > > > >There's a newline after the (run) function call from when you press > > > ><Enter> and the first (readline) call returns that newline. That's > > > >just how things work in Jess, sorry. This problem won't occur in a > > > >real system because no one would type all the rules in each time they > > > >wanted to run them; they'd put the rules in a file. If you put the > > > >rules in a file and use (batch), or if you start jess.Main as "java > > > >jess.Main file.clp", then the rules and the runtime input are coming > > > >from two different places, so there's no interference. > > > > > > > >Before you decide that this is "wrong", try an experiment: what does > > > >this line do in Jess if you type it at the command line? > > > > > > > >(defrule foo => (printout t fire crlf)) (reset) (run) > > > > > > > >What does it do in a batch file? That's right; in both cases, it > > > >prints "fire". > > > > > > > >Now try the same thing in CLIPS. In both cases, it just defines the > > > >rule, and doesn't run it. CLIPS ignores everything on a line of input > > > >after the first complete expression. Which do you like better? Which > > > >is more surprising? > > > > > > > > > > > >I think Abdul Gaffar wrote: > > > > > > > > > > Greetings > > > > > > > > > > I am having problems trying to execute my code in JESS. The code > >works > > > >fine > > > > > under CLIPSWIN, but if I try and run it in JESS then I get strange > > > > > behaviour. For example when program is run, it should ask the > >questions > > > >ONE > > > > > AT A TIME instead of having both questions asked together. The code > > > >snippet > > > > > for the startup rule is shown below. > > > > > > > > > > (defrule startup "define initial WME's created by (reset) " > > > > > => > > > > > (printout t "Welcome to the diagnosis program " crlf) > > > > > (printout t "The system will ask you a series of questions " crlf) > > > > > (printout t "to which you need to answer Y or N " crlf) > > > > > > > > > > (printout t "Have you experience any swelling ? (Y or N): ") > > > > > (assert (goal > > > > > (type swelling) > > > > > (value (readline)))) <--Should ask this and wait for response. > > > >Instead > > > > > it displays this 1st question and diplays the statement below > > > >simultaneously > > > > > and waits for user input there. I dont see why it does this. > > > > > > > > > > (printout t "Have you been injured recently ? (Y or N): ") > > > > > (assert (goal > > > > > (type injury) > > > > > (value (readline))))) > > > > > > > > > > Can anyone help as its doing my head in.. Just doesnt make any sense > >at > > > >all. > > > > > Is this a Bug in JESS?? > > > > > > > > > > Here is the output from running the code. > > > > > ***************** > > > > > Welcome to the diagnosis program > > > > > The system will ask you a series of questions > > > > > to which you need to answer Y or N > > > > > Have you experience any swelling ? (Y or N): Have you been injured > > > > > recently ? (Y or N): > > > > > > > > > > ****************************************** > > > > > > > > > > _________________________________________________________________ > > > > > MSN Photos is the easiest way to share and print your photos: > > > > > http://photos.msn.com/support/worldwide.aspx > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > > To unsubscribe, send the words 'unsubscribe jess-users > >[EMAIL PROTECTED]' > > > > > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > > > > > (use your own address!) List problems? Notify > > > >[EMAIL PROTECTED] > > > > > -------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > >--------------------------------------------------------- > > > >Ernest Friedman-Hill > > > >Distributed Systems Research Phone: (925) 294-2154 > > > >Sandia National Labs FAX: (925) 294-2234 > > > >Org. 8920, MS 9012 [EMAIL PROTECTED] > > > >PO Box 969 http://herzberg.ca.sandia.gov > > > >Livermore, CA 94550 > > > > > > > >-------------------------------------------------------------------- > > > >To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > > > >in the BODY of a message to [EMAIL PROTECTED], NOT to the list > > > >(use your own address!) List problems? Notify > >[EMAIL PROTECTED] > > > >-------------------------------------------------------------------- > > > > > > > > > > > > > > > _________________________________________________________________ > > > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > > > > > > > -------------------------------------------------------------------- > > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > > > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > > > (use your own address!) List problems? Notify > >[EMAIL PROTECTED] > > > -------------------------------------------------------------------- > > > > > > > > > > >--------------------------------------------------------- > >Ernest Friedman-Hill > >Distributed Systems Research Phone: (925) 294-2154 > >Sandia National Labs FAX: (925) 294-2234 > >Org. 8920, MS 9012 [EMAIL PROTECTED] > >PO Box 969 http://herzberg.ca.sandia.gov > >Livermore, CA 94550 > > > >-------------------------------------------------------------------- > >To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > >in the BODY of a message to [EMAIL PROTECTED], NOT to the list > >(use your own address!) List problems? Notify [EMAIL PROTECTED] > >-------------------------------------------------------------------- > > > > > > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > -------------------------------------------------------------------- > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > (use your own address!) List problems? Notify [EMAIL PROTECTED] > -------------------------------------------------------------------- > -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
