(i) the <!--ysh> and <!--/ysh--> tags inform wysh where the rulebase starts and ends;
(ii) the <PRE> and </PRE> tags ensure that the rulebase is treated as pre-formatted text, otherwise it would simply appear on the web page as one long line of text.
These tags may only be used once on any page, enclosing the whole knowledgebase. No other HTML tags may be used within the knowledge base (this may later be changed, but must be observed for now). Any other HTML may appear before the <PRE><!--ysh> tags or after the <!--/ysh--> </PRE> tags.
An example of how a small knowledgebase would appear on a web page is as follows:
<PRE> <!--ysh> RULE Freedom of Information Act 1982 (Cth) s11 PROVIDES a person has a legally enforceable right under s11 to obtain access to a document ONLY IF s11(a) applies OR s11(b) applies <!--/ysh--> </PRE>
After inserting the URL, click on the `Consult!' button to run the rulebase.
<A HREF="http://wysh.austlii.edu.au/do/wysh?rulebase=URL OF PAGE">LINK TEXT</A>In this tag, `URL OF PAGE' is to be replaced by the address of the page containing the rulebase, and `LINK TEXT' is to be replaced by the text you wish to appear as the hypertext link which is used to start the consultation running. The following example could beused for the FOI rulebase, and would cause the words `Run consultations' to appear as the hypertext link:
<A HREF="http://wysh.austlii.edu.au/do/wysh?rulebase=http://www2.austlii.edu.au/~graham/wysh/foi1.html"> Run consultations</A> using the FOI s11 knowledgebase
The purpose of this template is to enable those who are unfamiliar with HTML to copy this page, `fill in the blanks' for a couple of pieces of information, paste their ysh knowledgebase into the page, and then place it on a web server (such as sandpit) so it can run.
To use the template, you need 4 pieces of information: (i) your name (it gets harder); (ii) the name you wish to give your page (eg `FOI s11' for the small example above); (iii) the URL (address) of your page; and (iv) the rulebase that you wish to incorporate in the page.
wysh template - http://www2.austlii.edu.au/~graham/wysh/wysh_template.html
to open this page in the editor. Since it is not a page already on your
local drive, the `Save Remote Document' window will appear - OK to continue.
Use `Save As' to save the page with a sensible name for your project (eg
`foi.htm').
Now use Netscape Gold to edit the following items in the template:
to edit the link, and you will see 'http://www2.austlii.edu.au/do/wysh?rulebase=URL
OF YOUR PAGE GOES HERE'. Replace the words 'URL OF YOUR PAGE GOES HERE'
with the full URL that your page will have when it is published. If you
are doing this as a class tutorial the address will be http://student.austlii.edu.au/~USERNAME/FILENAME.HTM
.
).
).
WARNING - Do not use Netscape Composer to edit these wysh template pages - it inserts garbage characters which stop it running. Netscape Gold does, however, seem to be OK. If there are problems, just edit the file in a word processor (and remember to save it as 'text only') or text editor.
If you are dong this tutorial in a computer lab in class, please save all files with a numbered version of your first initial and surname, to a maximum of 8 digits. For example, John Bradshaw would save files named JBRADSH1.HTM, JBRADSH2.HTM, JBRADSH3.HTM etc. This will make it much easier to identify files and `clean up' the aiail directory when needed.
<HTML> <HEAD> <TITLE>wysh example - YOUR TITLE</TITLE> </HEAD> <BODY> <H1><IMG SRC="http://www.austlii.edu.au/images/ysh.gif" HEIGHT=32 WIDTH=32 ALIGN=BOTTOM>wysh example - YOUR TITLE </H1> <P><B>Author: YOUR NAME</P></B> <P>This is a demonstration of rule-based inferencing using the ysh inferencing engine and the wysh interface to ysh. It has been written as a student project for the purposes of <A HREF="http://www2.austlii.edu.au/~graham/CAL/">LAWS 4619 - Developing Computer Applications to Law (B)</A> at the University of New South Wales Faculty of Law. This project must not be relied upon or used for the purpose of legal advice. <BR>Further information and examples can be found in the <A HREF="http://www.austlii.edu.au/links/World/Subjects/Computerisation_of_Law/Web_Tools/wysh/">wysh index</A>. </P> <P> <HR></P> <H4><A HREF="http://www2.austlii.edu.au/do/wysh?rulebase=URL OF YOUR PAGE GOES HERE">Run consultations</A> using the YOUR TITLE knowledgebase</H4> <HR> <P> <H3>YOUR TITLE knowledgebase</H3> <PRE><!--ysh--> [PASTE YOUR KNOWLEDGEBASE HERE, REPLACING THIS LINE OF TEXT ONLY] <!--/ysh--> </PRE> <HR> <P><A HREF="http://www.austlii.edu.au/austlii/personnel.html#andrew">Andrew Mowbray</A> wrote the ysh inference engine (1991-94).<BR> <A HREF="http://www.austlii.edu.au/austlii/personnel.html#geoff">Geoffrey King</A> wrote the wysh web interface to ysh (1996 - ) (further details on the <A HREF="http://www.austlii.edu.au/austlii/wysh/">wysh pages</A>).<BR> <A HREF="http://www.austlii.edu.au/">AustLII</A>'s research on legal inferencing via the web is funded by the Australian Research Council.</P> </BODY> </HTML>
See 5. Integration of Wysh rulebases into AustLII and the World Wide Web in the Wysh Developers' Manual.
There are two ways to create automatic links from rulebases.
The first method is simple and useful for testing. On the `wysh manual start page (Enhanced version)', simply check the box which appears after the `Paste the rulebase here:' window:
The automatic creation of links works both with rulebases entered under the `Enter a URL of a rulebase:' window, and the `Paste the rulebase here:' window.
For example:
is the URL that appears under the `Run consultation' link on the `FOI s11 (start here)' page.http://www2.austlii.edu.au/do/wysh?rulebase=URL OF YOUR PAGE GOES HERE&markup=ON
When replacing `URL OF YOUR PAGE GOES HERE', make sure you do not delete `&markup=ON' (assuming you want automated links), and make sure that there is no blank space before `&markup=ON', or any blank space after `=`.LINK ...TO ... can be used to create links from a rulebase to anywhere on the world-wide-web, not just to AustLII.
LINK document of an agency TO http://www2.austlii.edu.au/au/legis/cth/consol_act/foia1982222/s4.html#document_of_an_agency RULE Freedom of Information Act 1982 (Cth) s11(a) PROVIDES s11(a) applies ONLY IF the document is a document of an agency AND the document is not an exempt document
anywhere on the world-wide-web, not just to AustLII
LINK official document of a Minister TO http://search.austlii.edu.au/do/sinosrch.pl?query=official+document+of+a+Minister&searchscope=Title+%26+Text&selection=All+AustLII+Databases&numhits=200&searchtype=Freeform RULE Freedom of Information Act 1982 (Cth) s11(b) PROVIDES s11(b) applies ONLY IF the document is an official document of a Minister AND the document is not an exempt document
More than two rulebases can be declared to be INCLUDEd. There is no limit on the number.
It does not matter if an INCLUDEd rulebase INCLUDEs the rulebase that INCLUDEd it - ie wysh ignores recursion and does not go into some endless loop of loading the same rulebases.
It is useful to make the URLs of INCLUDEd rulebases live links, so that users of a knowledgebase can conveniently view all knowledgebases which are to be included in a consultation. See the `FOI s11 (start here)' rulebase for examples.
INCLUDE http://sandpit.austlii.edu.au/~aial/foitest/foi_s11_b.html INCLUDE http://sandpit.austlii.edu.au/~aial/foitest/foi_s11_a.html PERSON a person THING the document GOAL RULE Freedom of Information Act 1982 (Cth) s11 PROVIDES a person has a legally enforceable right under s11 to obtain access to a document ONLY IF s11(a) applies OR s11(b) applies
If more than one GOAL RULE is specified in a set of `co-operative' rulebases, the user will be given a choiice of which rule is to start the consultation. GOAL RULEs may be declared in any rulebase.
INCLUDE http://sandpit.austlii.edu.au/~aial/foitest/foi_s11_b.html INCLUDE http://sandpit.austlii.edu.au/~aial/foitest/foi_s11_a.html LINK document TO http://www2.austlii.edu.au/au/legis/cth/consol_act/foia1982222/s4.html#documentdoes not yet result in `document' being hypertext linked from all three knowledgebases, but only from the one in which it occurs.
This is being changed so that LINK ... TO ... declarations will be `global' unless you declare them to be local.
2.2. Expanding your ysh rulebase
This exercise aims to guide you to some of the more important parts of the ysh/wysh Developers Manual. Use the list below as a check-list of important things to understand about ysh.
Understand how to name a non-boolean attribute type, and how to declare one (if you need to).
See 2.8. Attributes (or 'Facts') in the Wysh Developers' Manual.
See 2.9. Constants in the Wysh Developers' Manual.
See Generating questions and explanations in the Wysh Developers' Manual.
Don't bother with your own attribute translations (p30) unless you have to.
See 3.2. Named subjects - names of people and things in the Wysh Developers' Manual.
See 4.2. Goals - LISTED rules and GOAL rules in the Wysh Developers' Manual.
See 4.4. Types of rules in the Wysh Developers' Manual.
Assertions and assignments (ASSERT and IS statements) are sometimes useful.
DETERMINE statements should be avoided, as they destroy the declarativce nature of the rulebase. Ditto for CALL statements.
See 4.5. Statements in the Wysh Developers' Manual.
See 4.6. Expressions - the use of operators in the Wysh Developers' Manual. for these and the other operators listed below.
Use the AND/OR operator instead of BEGIN-END operators.
See 4.7. Some style guidelines for Wysh applications in the Wysh Developers' Manual.