2

I finished reading a book on clips expert system shell before I heard about Jess.

I'm trying to implement a web based expert system. I've written the code on clips, but the program has to run from the command line, however I would like to implement it in jess so that I can use it with jsp.

I need to use to ask questions and retrieve answers from the user and then use these answers as facts.

How can I do this with without having to rewrite everything again?

Vasili Syrakis
  • 9,321
  • 1
  • 39
  • 56
  • 1
    The Jess manual has an excellent section about using Java from Jess, and calling Jess from Java is also discussed in depth. - Are you just asking to gain confidence? – laune Feb 07 '14 at 09:14
  • Hi.. I can easily call any rules.clp file from java and it would run, printing out information to the console on eclipse. but my problem is getting data in clips to interact with java. It's supposed to be a web application using servlets and jsp, and my goal is to get input from a html form, assert the input as a fact, generate the next question, and display it on the form. The manual only describes what to do if you want to use UI from java.awt and the process apparently does not apply to my problem. – user3282954 Feb 09 '14 at 17:17
  • I've made some progress since yesterday, and I've been able to get the questions as strings using StringWriter, but for some weird reason, the TextReader function does not want to work. I'll be really flattered if I can just get a pointer to any algorithm or code that can help me on this. Thank you very much – user3282954 Feb 09 '14 at 17:18
  • I think the trick is that you have to think of this more like a web application. The rule engine can't prompt the user and wait for an answer, as in an interactive application; instead, user input drives the process. So the user fills out a form of some kind and presses a button. The data is sent to the server. A servlet (or similar) takes the data, uses the rule engine API to adds some new facts based on that data into working memory, runs the engine, extracts any new questions from it, and presents those to the user as new questions. – Ernest Friedman-Hill Feb 11 '14 at 19:40
  • Any rules that currently print to the screen or read from the keyboard have to me modified to just interact with working memory instead, and then you have to add new servlet/CGI code which uses the rule engine's API to interact with its working memory and implement the pattern described above. – Ernest Friedman-Hill Feb 11 '14 at 19:43
  • Wow.. thanks a lot. I hadn't even thought of that.. guess I was too busy trying to be lazy and not modify the clips code at all. you just made my intention of getting user input using clips sound so silly. Thank you very much!! @Ernest Friedman-Hill – user3282954 Feb 11 '14 at 21:29

2 Answers2

1

Depending on how you wrote your CLIPS code -- in particular, whether you used the CLIPS object extensions or CLIPS generic functions (neither of which exist in Jess) -- you may be able to run your code directly in the Jess engine with little or no change. The best thing to do is probably to just try it, and see how far you get.

Both CLIPS and Jess are quite flexible systems as far as integrating with other software. Jess is obviously very easy to integrate with all Java-based systems, and there are CLIPS bindings for Python and other languages that are easy to use on the Web. So even if you decide to stick with CLIPS, you shouldn't have any problems creating a web-based application.

Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186
  • Hi. I know it should be a really trivial problem, but I just can't get it to work. I need to be able to read input from a html form, assert it as a fact in clips and get another question to display on the form till all the questions are exhausted. I've tried everything I can, but it's just not working except if i call the Rete,run() method which makes it output information to the console on eclipse. – user3282954 Feb 09 '14 at 17:18
  • I tried using PHLIPS, which is a clips plugin for php, but it turned out too be too old, and cannot work with the current version of php and apache. Please I really need help cos I'm totally frustrated right now. I've never programmed in python before, but I'll be willing to try it if i can be sure that I wont have the same experience I had with php and java. Thanks a lot. – user3282954 Feb 09 '14 at 17:19
0

Check the FAQ page of CLIPS. It has listed several extensions that can integrate CLIPS with programming languages (including PHP, Perl and .NET). Perhaps you can do the interface using other languages.

http://clipsrules.sourceforge.net/FAQ.html (see q.8)

wmac
  • 1,023
  • 1
  • 16
  • 34