Ernest Friedman-Hill
Sat, 24 Oct 2009 09:33:22 -0700
If the "run" call is not in the file, then you'd get it however you get anything in JavaSpaces (I have no idea personally). So you must be thinking the "run" command would be the last line of the batched script? The "parse" function returns that value of the last evaluated expression, so if the file ends in (run), the return value of parse() will be the number of rules fired.
On Oct 24, 2009, at 10:58 AM, Andrew Meng wrote:
I got that part, thanks a lot for helping me at weekend!And after executing paser.parse(false), how do I get the return value(the number of rules fired) of engine.run() method?From: ejfr...@sandia.gov To: jess-users@sandia.gov Subject: Re: JESS: How to load a rule file in a remote RMI client. Date: Sat, 24 Oct 2009 10:52:22 -0400You want to send the file contents as a String to the remote host, andlet the remote host parse it and run it. On Oct 24, 2009, at 12:01 AM, Andrew Meng wrote:but the document says "Instances of Jesp are not serializable, as they hold a reference to a Reader." Therefore RMI can not serialize it to the remote host. And after run paser.parse(false), how do I get the result of engine.run(the number of rules fired)? Thanks, AndrewFrom: ejfr...@sandia.gov To: jess-users@sandia.gov Subject: Re: JESS: How to load a rule file in a remote RMI client. Date: Fri, 23 Oct 2009 23:20:07 -0400 It's very easy. See http://www.jessrules.com/jess/docs/71/library.html#jess.Jesp Follow the first example, but use a StringReader instead of the FileReader. On Oct 23, 2009, at 10:28 PM, Andrew Meng wrote:Thanks a lot for the quick reply!As a workaround, I did copy the xxx.clp over to the remote machine.However I want to make a generic remote worker who just takes a taskfrom JavaSpace and execute task.execute(). My task is like: class task{ ... public Object execute(){ ... engine.batch("xxx.clp"); if (engine.run() > 1) { does something and return} } } Yes, I can read the xxx.clp into a string as a part of the task object which will be serialized to the remote host by RMI. Afterreading Jesp API and JIA book, I still could not figure out the Jespsyntax to do what I want to do. Can you please elaborate more? Thanks a lot, AndrewFrom: ejfr...@sandia.gov To: jess-users@sandia.govSubject: Re: JESS: How to load a rule file in a remote RMI client.Date: Fri, 23 Oct 2009 20:46:09 -0400 If you want a process on a remote machine to open a file by name, thenof course you'd need to transmit the file. But you can instead readthe file into a String and send the String around; then use aStringReader and the jess.Jesp class to run the code on the remote machines (see the Jess manual on how to use jess.Jesp to parse Jesscode.) On Oct 18, 2009, at 10:41 PM, ameng wrote:Hello, I am trying to integrate Jess with JavaSpace(RMI). Tasks(running rete.batch("rule.clp")) put into a JavaSpace got following exception on the remote machine: Jess reported an error in routine batch. Message: Cannot open file. at jess.Batch.findDocument(Batch.java:221) at jess.Batch.batch(Batch.java:122) at jess.Batch.batch(Batch.java:113) at jess.Batch.batch(Batch.java:75) at jess.Batch.batch(Batch.java:40) at jess.Rete.batch(Rete.java:2791) What are the options here to pass the rules file to remote rete engine? Thanks a lot, Andrew -- View this message in context: http://www.nabble.com/How-to-load-a-rule-file-in-a-remote-RMI-client.-tp25952603p25952603.html Sent from the Jess mailing list archive at Nabble.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 . ----------------------------------------------------------------------------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, 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--------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, 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--------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012 ejfr...@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
--------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012 ejfr...@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. --------------------------------------------------------------------