Hi Florian, Rules "handle" input by activating and firing in response to the assertion of facts that match their LHS patterns. If you want a rule to "handle" some input data, simply write a rule that matches a fact containing that data.
Just have the event handler code for your "OK" button (or whatever GUI control starts your processing) assert all of your variables wrapped as Jess facts. Then, when your rules "see" those facts containing your data, their RHS code can process it. An example fact template would be: (deftemplate datum "A linear regression variable" (slot variable) (slot value) ) Using the Jess language, you can then assert facts like so... (assert (datum (variable beta_sz)(value 52.5))) >From Java proper, this would be something like: Rete engine = new Rete(); engine.eval("(deftemplate datum \"A linear regression variable\" (slot variable) (slot value))"); Fact datum = new Fact("datum", engine); datum.setSlotValue("variable", new Value("beta_sz", RU.SYMBOL)); datum.setSlotValue("value", new Value(52.5, RU.FLOAT)); engine.assertFact(f); ... - If you are really ambitious, use a grid control on a form to act as the input/output control to a backend spreadsheet. For example, you could write an I/O widget that extends javax.swing.JTable and is databound to an Excel file via Apache Poi. You will have to rig all the plumbing, but it can be done. Better to use an existing widget. For a Swing app, something like QuickTable <http://quicktable.org/> looks promising. If you go the webapp/AJAX route, there are all sorts of databound grid widgets (e.g. Smart GWT <http://code.google.com/p/smartgwt/>, showcase<http://www.smartclient.com/smartgwt/showcase/#main> ) - By the way: Have you looked at integrating R with Jess? R is a very powerful statistics package, and the JRI <http://www.rforge.net/JRI/>API let's you integrate it with Java. Hope this helps! Cheers, Jason ------------------------------------------------------ Morris Technical Solutions LLC consult...@morris-technical-solutions.com (517) 304-5883 On Fri, Mar 18, 2011 at 8:35 AM, Flogger <flog...@drfaltus.de> wrote: > Hi Community, > > not long ago I asked you how to store rules in an excel sheet. Me and my > tutor are totally ok with the apache api for accessing our rules. > I programmed a small GUI were all the input can be made. > My question right now is: > Is it possible to link my input fields to my seperated jess-file called > Bachelorarbeit.clp? > And my other question is: > How do I have to write the rules in Bachelorarbeit.clp so they can > handle input? > I tried working with the examples from "Jess in Action" but so far I was > not successful. > At the moment my "program" looks like this: > > (bind ?beta_sz 52.5) > (bind ?b_sz 2.5) > (bind ?l_sz 3) > (bind ?r_sz_2 0.6) > (bind ?r_sz_3 0.3) > > > (progn (bind ?TEPS_linear (+ (* ?b_sz -0.216) > (* ?l_sz 0.685) > (* ?r_sz_2 0.392) > 0.867 )) > (printout t "TEPS_linear ist " ?TEPS_linear crlf)) > > > (progn (bind ?TEPS_poly (+ (* +0.000 (** ?beta_sz 4)) > (* +0.035 (** ?b_sz 1)) > (* -0.103 (** ?l_sz 3)) > (* -0.163 (** ?r_sz_2 5)) > (* -0.002 (** ?r_sz_3 5)) > -0.126) > ) > (printout t "TEPS_polynomial ist " ?TEPS_poly crlf) > ) > > I declared my variables to check if i can handle the formulas. What i > want to do now is to write a piece of code to catch the variables from > the GUI (?beta_sz to ?r_sz_3). When this is done I finally want to > outsource the rule part to excel and only have the GUI and the catcher > for my variables in the code. > Thank you in advance guys. > I am happy for every little piece of help. > Greetings from good old cloudy cold Germany > Florian > > > > > -------------------------------------------------------------------- > 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. > -------------------------------------------------------------------- > >