JESS: changing facts in a fact file
Hi, I have to create a KBS with a fact-file, which is extended every 10 minutes. I think it's possible to check in a certain intervall if the facts-file is changing or not (like polling), but is there another possibility? How does JESS recognize when facts in a fact-file are changing (example)? Thanks for advance, Tanja -- Dipl.-Ing. Vicovac Tanja Forschungsgruppe Ingenieurgeodäsie Institut für Geodäsie und Geophysik Technische Universität Wien Gußhausstraße 27-29 / E128-3 A-1040 Wien E-mail: tanja.vico...@tuwien.ac.at Web: http://info.tuwien.ac.at/ingeo Tel.: (+43)-(0)1-58801-12844 Fax: (+43)-(0)1-58801-12894 To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
Re: JESS: changing facts in a fact file
JESS simply loads the file and forgets about it. If you want to monitor a file, you'll have to do that yourself and then call clear and batch. If you don't want to reload the entire file, you'll have to maintain state and keep track of the last line and then only assert the new facts. why not just send the new facts to JESS directly? peter On Wed, Mar 11, 2009 at 10:30 AM, Tanja Vicovac tanja.vico...@tuwien.ac.at wrote: Hi, I have to create a KBS with a fact-file, which is extended every 10 minutes. I think it's possible to check in a certain intervall if the facts-file is changing or not (like polling), but is there another possibility? How does JESS recognize when facts in a fact-file are changing (example)? Thanks for advance, Tanja -- Dipl.-Ing. Vicovac Tanja Forschungsgruppe Ingenieurgeodäsie Institut für Geodäsie und Geophysik Technische Universität Wien Gußhausstraße 27-29 / E128-3 A-1040 Wien E-mail: tanja.vico...@tuwien.ac.at Web: http://info.tuwien.ac.at/ingeo Tel.: (+43)-(0)1-58801-12844 Fax: (+43)-(0)1-58801-12894 To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
Re: JESS: changing facts in a fact file
On Wed, Mar 11, 2009 at 3:30 PM, Tanja Vicovac tanja.vico...@tuwien.ac.atwrote: Hi, I have to create a KBS with a fact-file, which is extended every 10 minutes. I think it's possible to check in a certain intervall if the facts-file is changing or not (like polling), but is there another possibility? That's what the UNIX utility tail (option -f) does, so I guess there isn't a better way ;-) You may find its C code when you google for tail.c. How does JESS recognize when facts in a fact-file are changing (example)? Jess expects the facts to be inserted/added to its working memory. I you have facts saved or assembled on a file, you have to call (load-facts ...) to add all the facts from this file at some appropriate time. -W Thanks for advance, Tanja -- Dipl.-Ing. Vicovac Tanja Forschungsgruppe Ingenieurgeodäsie Institut für Geodäsie und Geophysik Technische Universität Wien Gußhausstraße 27-29 / E128-3 A-1040 Wien E-mail: tanja.vico...@tuwien.ac.at Web: http://info.tuwien.ac.at/ingeo Tel.: (+43)-(0)1-58801-12844 Fax: (+43)-(0)1-58801-12894 To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov
Re: JESS: changing facts in a fact file
Hi Tanja, There is also an API called JNotify that allows one to receive file system events on Windows and LINUX. See: http://nixbit.com/cat/programming/libraries/jnotify/ http://sourceforge.net/projects/jnotify/ See if this is what you need. You can also have a thread periodically monitor your file system. Cheers, Jason On Wed, Mar 11, 2009 at 10:30 AM, Tanja Vicovac tanja.vico...@tuwien.ac.atwrote: Hi, I have to create a KBS with a fact-file, which is extended every 10 minutes. I think it's possible to check in a certain intervall if the facts-file is changing or not (like polling), but is there another possibility? How does JESS recognize when facts in a fact-file are changing (example)? Thanks for advance, Tanja -- Dipl.-Ing. Vicovac Tanja Forschungsgruppe Ingenieurgeodäsie Institut für Geodäsie und Geophysik Technische Universität Wien Gußhausstraße 27-29 / E128-3 A-1040 Wien E-mail: tanja.vico...@tuwien.ac.at Web: http://info.tuwien.ac.at/ingeo Tel.: (+43)-(0)1-58801-12844 Fax: (+43)-(0)1-58801-12894 To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov
Re: JESS: changing facts in a fact file
Instead of modifying the existing file, why not create a new file? that way you can just load each new file at the set interval? the other approach I've used in the past is to sent facts to JESS using JMS messaging peter On Wed, Mar 11, 2009 at 1:00 PM, Jason Morris jason.c.mor...@gmail.com wrote: Hi Tanja, There is also an API called JNotify that allows one to receive file system events on Windows and LINUX. See: http://nixbit.com/cat/programming/libraries/jnotify/ http://sourceforge.net/projects/jnotify/ See if this is what you need. You can also have a thread periodically monitor your file system. Cheers, Jason On Wed, Mar 11, 2009 at 10:30 AM, Tanja Vicovac tanja.vico...@tuwien.ac.atwrote: Hi, I have to create a KBS with a fact-file, which is extended every 10 minutes. I think it's possible to check in a certain intervall if the facts-file is changing or not (like polling), but is there another possibility? How does JESS recognize when facts in a fact-file are changing (example)? Thanks for advance, Tanja -- Dipl.-Ing. Vicovac Tanja Forschungsgruppe Ingenieurgeodäsie Institut für Geodäsie und Geophysik Technische Universität Wien Gußhausstraße 27-29 / E128-3 A-1040 Wien E-mail: tanja.vico...@tuwien.ac.at Web: http://info.tuwien.ac.at/ingeo Tel.: (+43)-(0)1-58801-12844 Fax: (+43)-(0)1-58801-12894 To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
JESS: engine.batch(InputStream)?
I'm using the 30-day trial of Jess, and have already run into a problem: Is there no engine.batch(InputStream) or equivalent for loading rule sets? We have to deliver our *.clp files in eclipse plugins, and can only access them by finding them in the Bundle and opening an input stream. I can read the stream and create a temporary file, then blow away the file after loading the engine, but having to do that is pretty dumb (and slow). engine.batch(String) would be convenient as well. How does everyone else do this? Surely not everyone reads from a file *always*?? -Eric
Re: JESS: engine.batch(InputStream)?
Hi Eric, Note that Rete.batch() (as well as all the variations available in the jess.Batch class, see http://www.jessrules.com/jess/docs/71/api/jess/Batch.html ) will actually fall back to using ClassLoader.getResourceAsStream() on the classpath. I know Eclipse's class loading is pretty complex, but you might just try and see if batch can find your files inside your jars. For the general solution, check out http://www.jessrules.com/jess/docs/71/library.html#jess.Jesp : import jess.Jesp; ... Reader aReader = ... Jesp parser = new Jesp(aReader, engine); parser.parse(false); On Mar 11, 2009, at 3:34 PM, Widhalm, Eric - Fort Collins, CO wrote: I'm using the 30-day trial of Jess, and have already run into a problem: Is there no engine.batch(InputStream) or equivalent for loading rule sets? We have to deliver our *.clp files in eclipse plugins, and can only access them by finding them in the Bundle and opening an input stream. I can read the stream and create a temporary file, then blow away the file after loading the engine, but having to do that is pretty dumb (and slow). engine.batch(String) would be convenient as well. How does everyone else do this? Surely not everyone reads from a file *always*?? -Eric - Ernest Friedman-Hill Informatics Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012ejfr...@sandia.gov Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.