The format of the web pages that ask questions of the user are controlled by four entries in your main knowledgebase. These are:
question_top |
<HTML><HEAD></HEAD> <BODY bgcolor=#FFFFFF text=#000000> <H2><IMG SRC="/images/bullet.gif" HSPACE=10><FONT COLOR=#0000A0> Amzi! Internet Site Guide </FONT></H2> <FORM METHOD="POST" ACTION="/cgi-bin/kwcgibasic.exe%system(cgi_parameters)%"> |
question_separator |
<P> |
value_separator |
<BR> |
question_bottom |
<P><INPUT NAME="submit" TYPE="submit" VALUE="Continue"></INPUT> </FORM> <BODY></HTML> |
In question_top you need to specify the correct URL to run KnowledgeWright.
Note the special system goal, system(cgi_parameters), this is used to pass the
CGI parameters from one form to the next. The example above is for running the
CGI interface. For, a Java Servlet, the <FORM> tag might read:
<FORM METHOD=""GET"" ACTION=""/amzi/KW"">
A question separator is inserted between each question and a value separator is inserted between each menu choice in a question.
The preferred way to dynamically build a web page is to create a text object that is the goal of your knowledgebase. Typically you set output_top and output_bottom in your main knowledgebase object to include your <HTML>, <HEAD> and <BODY> tags. For example:
output_top |
<HTML><HEAD></HEAD><BODY bgcolor=#FFFFFF text=#000000> |
output_bottom |
</BODY></HTML> |
Then in your text object you would include the dynamically generated sections along with fixed text and HTML tags. For example, the Amzi! Website Advisor has a text object with the following contents:
text |
<H2><IMG SRC="/images/bullet.gif" HSPACE=10> <FONT COLOR=#0000A0> Amzi! Internet Site Guide</FONT></H2> <HR><P><FONT SIZE=3><I><B> We recommend these articles, demos, newsgroups, and other sites for you... </B></I></FONT><P> %resource% <HR><P><FONT SIZE=3><I><B> We recommend these tools, products and services for you... </B></I></FONT><P><UL> %tool% </UL><P>All <A HREF="/company/index.htm">Amzi!</A> products include free tech support (via internet, phone and fax), are not copy protected and are royalty-free.</P> |
Note, the %resource% and %tool% in the text. These are sub-goals. So the reasoning
engine will try to determine values for these objects. For the Website Advisor,
resource and tool are rule_sets. The values of the rules
are text that have embedded HTML tags. For example, here are some entries in
the resource rule_set:
conditions value exploreProlog = "yes" and prologFamiliarity \= "Very" "To understand more about Prolog's unique backtracking and unification algorithms see the PC AI article <A HREF=""/articles/prolog_under_the_hood.htm""> Prolog Under the Hood</A>. For more information on <B>Prolog</B>, see the <A HREF=""http://fas.sfu.ca/0/cs/people/ResearchStaff/jamie/personal/prolog-faq.1""> Prolog FAQ</A> and the <A HREF=""news:comp.lang.prolog"">Prolog newsgroup</A>. Find lots of source code in <A HREF=""http://users.ox.ac.uk/~popx/"">Jocelyn Paine's public domain library</A> and the <A HREF=""http://www.cs.cmu.edu/Groups/AI/html/repository.html""> Carnegie Mellon Repository</A>." embeddedDevelopment = "yes" and languagesAndTools include "Java" "See the PC AI article on <A HREF=""/articles/java_class.htm"">Java Meets Prolog</A> which describes the <B>Amzi! Java Class</B>. If you have the Sun JDK, you can run the <A HREF=""http://www.amzi.com/download/demos/java_ship.zip""> shipping advisor demo</A>."
Note, that these text values could also include further sub-goals in percent signs. This provides alot of flexibility for generating and formatting your documents.
If you choose to have multiple goals in your knowledgebase, then the HTML in output_continue is used to continue the reasoning process and to proceed onto the next goal. In this case the user will see a series of questions followed by some results, then another series of questions and more results.