6. Document assembly using DataLex
DataLex also includes an automated document generation (or 'assembly') component. This aspect is not yet developed fully. The features described below are sufficient to generate simple documents.
6.1 DOCUMENT rules
Documents may be generated by declaring rules of type
DOCUMENT. Normally, one DOCUMENT rule will generate one paragraph of a document, and a group of rules can be used to generate all the clauses of a legal document. DOCUMENT rules differ from other types of rules only in that the statements
PARAGRAPH and
TEXT are available to
write paragraphs to documents. The syntax is discussed below under the heading
Statements.
Document rules are only ever effective if they are declared a
GOAL rule or if explicitly
called (via the
CALL statement) from other rules.
6.1.1 DOCUMENT rules as goals
If the GOAL rule is a DOCUMENT rule, the usual report generated by a consultation is replaced by the generated document (ie no report is generated).
6.1.2 Example - a clause of a will
The following example is a DOCUMENT rule for one clause of a will, with two alternative conditional forms of the clause. The elements of the example are explained below.
DOCUMENT Revocation PROVIDES
IF all former testamentary disposition are to be revoked THEN
NUMBERED PARAGRAPH I revoke all former testamentary dispositions.
ELSE
NUMBERED PARAGRAPH I revoke all former testamentary dispositions
except clause(s) <list of clauses from the old will which are to be
saved> of my testamentary disposition dated <the date of the old will>
which clause(s) I hereby confirm.
6.2 Text generation statement types - PARAGRAPH and TEXT
The two statement types PARAGRAPH and TEXT allow text to be added to documents from rules of type
DOCUMENT. They have no effect in non-document rules, and should not be used in such rules. The syntax for these special types of document statements is:
[NUMBERED] [LEVEL number] [PARAGRAPH|TEXT] text
6.2.1 The text argument and embedded attributes
The
text argument is a piece of text (of any length) to be generated as part of the document being assembled if the conditions of the rule are satisfied. A
text argument may include embedded attributes, but is not in itself an attribute, so DataLex does not attempt to obtain a value (true/false) for it. DataLex recognises that a piece of text is
text, not an attribute, because it is preceded by the statement type PARAGRAPH or TEXT.
However, DataLex does attempt to obtain a value for any attributes embedded within the text, provided that those attributes are enclosed in angle brackets (ie <
attribute>).
For example, the following statement would cause all of the text after ‘PARAGRAPH’ to be printed in a new paragraph. The values of the embedded attributes (the attributes within angle brackets ie <>) will be obtained from the user in a dialogue (see below).
PARAGRAPH I revoke all former testamentary dispositions
except clause(s) <list of clauses from the old will which are to be
saved> of my testamentary disposition dated <the date of the old will>
which clause(s) I hereby confirm.
The example given above and on the previous page will generate the following dialogue:
1) Are all former testamentary disposition to be revoked ?
** n
2) What is list of clauses from the old will which are to be saved?
** 1, 5 and 17
3) What is the date of the old will ?
** 1 May 1993
REPORT
1. I revoke all former testatmentary dispositions except clause(s)
1, 5 And 17 of my testamentary disposition dated 1 May 1993 which
clause(s) I hereby confirm.
6.2.2 Differences between PARAGRAPH and TEXT
The difference between the two types of statements is simply one of layout: the
PARAGRAPH statement places an HTML paragraph marker before the text (ie a carriage return and a blank line) and
TEXT just inserts a space (ie no new line).
PARAGRAPH must be used to cause a new paragraph of text to be included in a document. It is insufficient to simply place new paragraphs or lines in the text argument, as DataLex will ignore these when it generates the document.
For example, the statements:
PARAGRAPH I revoke all former testamentary dispositions.
I give all my property to my husband.
will be generated as:
I revoke all former testamentary dispositions. I give all my property to my husband.
The correct code to cause the second sentence to be a new paragraph is:
PARAGRAPH I revoke all former testamentary dispositions.
PARAGRAPH I give all my property to my husband.
6.3 ‘Personalising’ documents - embedded attributes
Where a document contains variable information (eg the name of the testator, the value of property, the date of death), this variable information (an attribute) can be included in the
text of a document statement by embedding the attribute in the text. In the example above, the embedded attribute ‘<list of clauses from the old will which are to be saved>’ will cause the user to be prompted to list those clause numbers, and the numbers will then be included in the generated document. The embedded attribute ’<the date of the old will>‘ will cause the user to be prompted for the value of that attribute.
6.3.1 Relationship between named subjects and embedded attributes
DataLex will not recognise that an attribute is embedded in text just because it has been declared to be a named subject. For example, the declarations
DATE the date of the old will
STRING list of clauses from the old will which are to be saved
will
not cause DataLex to ask the user for values in a rule where angle brackets have been omitted, such as
PARAGRAPH I revoke all former testamentary dispositions
except clause(s) list of clauses from the old will which are to be
saved of my testamentary disposition dated the date of the old will
which clause(s) I hereby confirm.
It is necessary to put attributes in angle brackets (< >); merely making them named subjects is insufficient.
However, merely putting an attribute in angle brackets does not give it a type - to do so it is necessary to declare it as a named subject as well. For example, in the dialogue above, an answer 'a few weeks ago' to the question 'What is the date of the old will ?' will be accepted. In contrast, if the declaration 'DATE the date of the old will' had been made, the following dialogue will occur:
3) What is the date of the old will ?
** a few weeks ago
Please respond with a date.
It is preferable to declare all embedded attributes as named subjects, as well as embedding them in angle brackets, so as to ensure that the user always gives the correct type of answer (eg a date).
6.3.2 Prompts for embedded attributes
The prompt for an embedded attribute is always 'what is .....?', even if the embedded attribute is a named subject of type PERSON. Therefore, it is necessary to either tolerate questions such as 'What is the testator's spouse?' , or to embed attributes in the form '<the name of the testator's spouse>' so as to get a question 'What is the name of the testator's spouse?'. However, if this second approach is taken, the embedded attribute will not match the named subject 'the testator's spouse' and this may cause other problems when that attribute is used elsewhere. In some cases it may be better to tolerate the awkwardly phrased question.
6.4 Alternative clauses in a document
An important element in document assembly is to allow alternative versions of a clause or paragraph or sentence to be generated, depending on the user's circumstances. For example, the structure of the example given above for a clause of a will is as follows:
DOCUMENT Revocation PROVIDES
IF all former testamentary disposition are to be revoked THEN
NUMBERED PARAGRAPH .......Alternative text (1).......
ELSE
NUMBERED PARAGRAPH ........Alternative text (2)........
Because of the use of the IF-THEN-ELSE statement, which version of the clause is generated depends upon the value of the attribute ‘all former testamentary disposition are to be revoked’. The user will be prompted for a value for this attribute by being asked ‘Are all former testamentary disposition to be revoked?’. If the user answers ‘yes’, then text (1) will be generated, but otherwise (ELSE) text (2) will be generated.
By the use of IF-THEN-ELSE statements, and any other conditional statements used in DataLex, templates for complex documents may be created.
6.5 Generating successive paragraphs of a document - use of CALL statements
The discussion above concentrates on the generation of single paragraphs of documents. To assemble a whole document it is usually necessary to create a GOAL rule which provides an overall procedural order for the creation of the document. For example, in the Will Generator example below, the following GOAL rule is used:
GOAL DOCUMENT Last Will & Testament PROVIDES
the date of execution of the will IS today
CALL Preamble
CALL Revocation
CALL Contemplation of Marriage
By use of the CALL statement, this rule calls three other rules in succession, those with the names ‘Preamble’, ‘Revocation’ and ‘Contemplation of Marriage’. In effect, it provides that this is the correct order of assembly of the clause of this document. The names following CALL must match the names of DOCUMENT rules.
The use of CALL statements may also be made conditional. For example, where a clause generated by a rule named 'Revocation' can only be used if a particular section of an Act applies (eg the Contracts Act s17), then the following CALL statement could be used:
IF s17 Contracts Act applies THEN CALL Revocation
6.5.1 Document generation is essentially procedural
This use of CALL statements as the basic method of assembling documents means that document assembly with DataLex is essentially procedural rather than declarative. Backward and forward chaining rules will rarely be useful to control the order of assembly of a document, because their normal usage is as rules which fire when needed, rather than in a controlled order (such as occurs with CALL statements). However, as discussed below, the evaluation of attributes used in DOCUMENT rules may trigger the operation of backward and forward chaining rules.
6.6 Numbering paragraphs
6.6.1 The NUMBERED keyword
If a statement is prefixed with the
NUMBERED keyword, the paragraph will be numbered automatically.
6.6.2 The LEVEL keyword
The optional
LEVEL keyword is used to control the type of numbering to be employed.
number must be between 1 and 7 (inclusive). The numbering style at each level is:
1. Level One
(1) Level Two
(a) Level Three
(i) Level Four
(A) Level Five
(I) Level Six
- Level Seven
Levels can be skipped (ie it is possible to go directly, say, from Level One to Level 3).
6.7 Integration of inferencing and document generation
One of the main strengths of DataLex as a document generator is that the document generation is fully integrated with forward and backward chaining inferencing. Therefore, where the evaluation of any statutory provision or other legal condition is a precondition for the generation of part of a document, it is only necessary to make the appropriate attribute a condition in the DOCUMENT rule, and DataLex will automatically use backward and forward chaining to interact with other parts of the rule-base.
For example, a statement in a DOCUMENT rule such as
IF the Act applies THEN PARAGRAPH ....(text follows)...
will cause DataLex to backward chain to evaluate a rule that has 'the Act applies' as a conclusion.
Note that the first DOCUMENT rule must be a GOAL rule or else DataLex will not produce a document.
6.8 Use of other DataLex features with document assembly
Some normal DataLex commands do not have any meaningful use when a DOCUMENT rule is being evaluated. The 'Why' command will only result in sensible answers when DataLex is evaluating an attribute in a RULE.
Conclusions from rules are generated during a document generation consultation, and are shown as numbered blue buttons. Explanations (How?) can be shown by selecting a conclusion. If a document is generated by a consultation, no separate Report is also generated – the Document replaces the Report.
The following DataLex functions do operate with document assembly: Facts ('What' command) appear as numbered green buttons; 'Forget' and 'Forget All' will forget facts and generate alternative documents.
Hypertext links to legislation (automatic links) or to defined terms or other text (explicit links) can be used with document generation in the same fashion as with other DataLex inferencing.
6.9 Example - a will generator
See <
http://austlii.community/foswiki/DataLex/WillGeneratorKB > for the simple will generator reproduced below. Note the following aspects:
- The GOAL Document is largely comprised of procedural steps.
- The attribute ‘the person making the Will is legally capable of making a Will’ causes the evaluation of the ‘Capability’ rule, by backward chaining. This rule could be expanded much further.
- The use of embedded attributes such as <list of clauses from the old will which are to be saved>, <the testator/testatrix's fiancee> and <the joint beneficiaries>.
DATE the date of execution of the Will
DATE the date of the old Will
INTEGER the maximum number of months within which the wedding must take place
PERSON the person making the Will
PERSONTHING the sole beneficiary
PERSON the sole executor
PERSON the testator/testatrix's fiancee
PERSON the joint beneficiaries
GOAL DOCUMENT Last Will & Testament PROVIDES
IF the person making the Will is legally capable of making a Will THEN BEGIN
CALL Disclaimer
CALL Preamble
CALL Revocation
CALL Contemplation of Marriage
CALL Sole Beneficiary
CALL Attestation END
ELSE the person making the Will should not make a Will
RULE Capability PROVIDES
the person making the Will is not legally capable of making a Will ONLY IF the person making the Will is not of sound mind
OR s6 of the Wills, Probate and Administration Act 1898 applies OR the person making the Will is subject to some other form of incapacity
DOCUMENT Disclaimer PROVIDES
PARAGRAPH Disclaimer: This is not a real Will and must not be used as such.
This will does not purport to accurately represent the law of any jurisdictions.
DOCUMENT Preamble PROVIDES
PARAGRAPH This will dated <the date of execution of the Will> is
made by me <the person making the Will>, of
<the testator/testatrix's address>, <the testator/testatrix's occupation>.
DOCUMENT Revocation PROVIDES
IF all former testatmentary disposition are to be revoked THEN
NUMBERED PARAGRAPH I revoke all former testatmentary dispositions.
ELSE
NUMBERED PARAGRAPH I revoke all former testamentary dispositions
except clause(s) <list of clauses from the old will which are to be
saved> of my testamentary disposition dated <the date of the old Will>
which clause(s) I hereby confirm.
DOCUMENT Contemplation of Marriage PROVIDES
IF this Will is to be made in contemplation of marriage THEN
IF the Will is to be conditional on the marriage actually
taking place THEN
IF the person making the Will is domiciled in Western Australia AND
the person making the Will does not own immovables in other States
THEN
NUMBERED PARAGRAPH This will is made in
contemplation of my marriage with
<the testator/testatrix's fiancee>.
ELSE
NUMBERED PARAGRAPH This will is made in
contemplation of my marriage with
<the testator/testatrix's fiancee>
and is conditional on the marriage taking place
within <the maximum number of months within which the wedding must take place> months.
ELSE IF the testator/testatrix is domiciled in Western Australia THEN
NUMBERED PARAGRAPH This will is made in contemplation of my
marriage with <the testator/testatrix's fiancee>
but shall not be void if the marriage does not take place.
ELSE
NUMBERED PARAGRAPH This will is made in contemplation of my
marriage with <the testator/testatrix's fiancee>
but is not conditional on the marriage taking place.
DOCUMENT Sole Beneficiary PROVIDES
IF everything disposed of under the Will is to be left one person THEN BEGIN
IF the sole beneficiary is over 18 THEN
NUMBERED PARAGRAPH I give the whole of my estate to <the sole beneficiary>
whom I appoint my sole executor. ELSE BEGIN
NUMBERED PARAGRAPH I give the whole of my estate to <the sole beneficiary>
NUMBERED PARAGRAPH I appoint the <the sole executor> as my sole executor. END
END ELSE BEGIN NUMBERED PARAGRAPH I give the whole of my estate in equal shares to <the joint beneficiaries>
NUMBERED PARAGRAPH I appoint the <the sole executor> as my sole executor. END
DOCUMENT Attestation PROVIDES
PARAGRAPH Signed by the testator in our presence and attested by us in the presence of him and each other.