Hi everybody, I am a new user of JESS and I am coming from Prolog's world, so I have some misunderstanding using Jess. First of all, I am trying to create a plan that I will have 3 actions: travel, hotel and rentalCar. As I have some preconditions that must be valid in order to execute an action, I want to estabilish a first order. I have only 3 actions because I am trying to understand Jess, so I need to know what exactly they are doing. How can I do the prolog's trace in Jess? Because he shows me only the steps and the result, but if I want to do step by step. I tried to create a batch file, here it is: (reset) (assert (in paris) (passportValid paris salvador)) (defrule travel "Travel" (in paris) (passportValid paris salvador) => (printout t "Travel service" crlf) (assert (in salvador) (travel ok) (airportArea salvador laurofreitas)) ) (defrule hotel "Hotel" (in salvador) (travel ok) => (printout t "Hotel service" crlf) (assert (hotel ok)) ) (defrule rentalcar "Rental a car" (in salvador) (travel ok) (hotel ok) (airportArea salvador laurofreitas) => (printout t "Rental Car service" crlf) (assert (car ok)) ) (defrule goal "Aim the goal" (travel ok) (hotel ok) (car ok) => (printout t "End of the plan" crlf) ) (run) When I run it, I receive this answer: Jess> (batch Z:/Implementacao/planning/travel.clp) ==> f-0 (MAIN::initial-fact) ==> f-1 (MAIN::in paris) ==> f-2 (MAIN::passportValid paris salvador) Travel service ==> f-3 (MAIN::in salvador) ==> f-4 (MAIN::travel ok) ==> f-5 (MAIN::airportArea salvador laurofreitas) ==> f-6 (MAIN::hotel ok) Rental Car service ==> f-7 (MAIN::car ok) End of the plan Hotel service 5
The first thing that I do not understand was why it writes "Hotel service" at the end if it was executed in the middle as we can see f-6 The next question, I have read about Jess but actually I do not understand what is exactly the best use for deftemplates? I know it is like classes/objects in Java, but in an inference motor where should I use it? In my example here, I thought that I could use, but actually I did not find where I can put it. Thanks in advance for all your help. Daniela -------------------------------------------------------------------- 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] --------------------------------------------------------------------