Facts Templates have the following syntax:
(deftemplate [<module-name>::]<symbol-name> [<string-comment>] <slot-definition>*)
<slot-definition> = (slot|field <symbol-name> <slot-attribute>*) | (multislot <symbol-name> <slot-attribute>*)
<slot-attribute> = (default ?DERIVE|?NONE|<constant>|<variable>|<function-call>)
(default-dynamic <value-expression>) |
(type SYMBOL | ATOM | STRING | INTEGER | FLOAT |
LEXEME | NUMBER | CLASS | DESCRIPTOR | OBJECT |
EXTERNALADDRESS | FUZZY | FACT | FACTID |
?VARIABLE | <deftype-name-expression>) |
(range ?VARIABLE|<numeric-expression> ?VARIABLE|<numeric-expression>)|
(cardinality ?VARIABLE|<integer-expression> ?VARIABLE|<integer-expression>)|
(allowed-values <expression>+)|
(allowed-lexemes <lexeme-expression>+) |
(allowed-strings <string-expression>+) |
(allowed-symbols <symbol-expression>+) |
(allowed-numbers <numeric-expression>+) |
(allowed-integers <integer-expression>+) |
(allowed-floats <float-expression>+) |
(units <string-expression>)
:: = Module separator. Module name is optional. If not specified, a rule belongs to the currently active module
Note: Brackets ([) and (]) define optional elements of the construct. The (|) character defines an or condition. An asterisk (*) defines zero or more of the preceding element (or disjunction of elements). A plus sign (+) defines one or more of the preceding element.
Valid Fact Template Definitions
(deftemplate person "A person template")
(deftemplate person Person-template (slot name))
(deftemplate person (slot name (default Tom)) (slot age) (multislot phone))