Term Syntax

Pro/3 home page  -  documentation overview  -  What is Pro/3?
term-syntax - term string-syntax - nested term-strings - basic terms and basic term-strings
» syntaxes  -  names - 3KB-type databases - SQL-type databases

 

The inference engine uses knowledge formatted as terms. All knowledge in 3KB-type databases are stored as terms. The term-format can be seen in the right-hand side of the Record-window, but the format is strictly internal and is never entered or altered directly by the knowledge engineer. Various higher-level and more intuitive formats are used instead.

Term-syntax
<Term> <BaseTerm> | <CompoundTerm>
<BaseTerm> atom(<QS>) | str(<QS>) | var(<QS>) | int(<IN>) | fix(<NU>) | <List> | nill | fstr(<QS>,<QS>,<QS>,<IN>) 
<CompoundTerm> cmp(<QS>,[ [ <Term> ] { ,<Term> }* ])
<IN> an integer literal
<List> nill | list(<Term>,<List>)
<NU> an integer or fixed-point literal
<QS> a quoted string of characters, excluding quotes and apostrophes. Curly brackets must be used with care to avoid confusing ordinary strings and "term-strings" i.e. a string representing a term (see under).

 

SQL-type databases cannot store the term-format directly, and a text-based representation of the terms known as term-strings are used instead.

Term string-syntax
<S_Term> <S_BaseTerm> | <S_CompoundTerm>
<S_Atom> {A<letter> { <characters> }* }
<S_BaseTerm> <S_Atom> | <S_String> | <F_String> | <S_Var> | <S_Int> | <S_Num> | <S_List> | <S_Nill>
<S_CompoundTerm> {C<S_String> [ <S_Term> ] { <S_Term> }* }
<S_Fstring> {F<characters>} <S_String> <S_String> <S_Int>
<S_Int> {I<digits>}
<S_List> {L<S_Term>* }
<S_Nill> {0}
<S_Num> {N<digits> [ .<digits> ] }
<S_String> {S<characters>}
<S_Var> {V { <letter> | _ } { <characters> }* }
 

Example:

The term

cmp("pExists",[eCar(atom("iMerz"),str("220S"),int(40000))])

has term-string representation

"{C{SpExists}{C{SeCar}{AiMerz}{S220S}{I40000}}}"

Note that the term-string in the term: str({T...} is represented as {T...} and not as {S{T...}}.

 

NESTED TERM-STRINGS

In cases where the value of a str(...) component of a term is itself a term-string, then a special bracketing syntax is resorted to make translation back from term-string to term possible:

<S_Tstring> {TlowerCaseLetter<characters>{lowerCaseLetter} the two lower-case letters must be the same - they form a special bracket for a term-string within a term-string. Term-strings can be nested by using different pairs of bracket lower case letters.

The term-string is bracketed e.g. by {Tx ... {x}, where x could be any lowercase letter. By choosing different letters it is possible to nest term-strings in term-strings in several levels.

Example:

The term (under), where the second string is a term-string bracketed by {Ti...{i}

cmp("xxx",[str("sss"),str("{Ti{C{SpExists}{C{SeCar}{AiMerz}{S220S}{I40000}}}{i}")])

has term-string representation

"{C{Sxxx}{Ssss}{Ti{C{SpExists}{C{SeCar}{AiMerz}{S220S}{I40000}}}{i}}"

 

Pro/3 uses the following lowercase letters in nested term-string brackets:

q The condition set query embedded in set-rules.
a The list of assignments embedded in set-rules.
d The list of concluded data element types embedded in set-rules.
s 1. The condition in a sentence count expression; 2.For trees represented as texts.
e The condition in a  deterministric data element reference expression.
n 1. The condition in a non-deterministic data element reference expression; 2.The name/label of a node in an inexact rule reasoning tree sentence.
x The condition in an existence expression.
p The actual parameters in an inexact rule reasoning tree sentence.
t The tree in an inexact rule reasoning tree sentence.
z Data elements of the term-string domain.
 

BASIC TERMS - BASIC TERM-STRINGS

Basic terms form a sub-set of terms, and adhere to the syntax under. Basic term-strings are term-string representations of basic terms.

<BasicTerm> cmp(<QS>,[ [ <SimpleTerm> ] { ,<SimpleTerm> }* ])
<SimpleTerm> atom(<QS>) | str(<QS>) | int(<IN>) | fix(<NU>)
<IN> an integer literal
<NU> an integer or fixed-point literal
<QS> a string literal