|
||||||||||||
First of all - where do facts and
rules come from? Facts and rules come from a knowledge engineer (KE for
short), who either is an expert in the area of interest, or one who has access to
such an expert. The KE formulates the knowledge so that Pro/3
can make use of it, and make use of it in a way that makes the system produce something
useful.
You cannot understand Pro/3 queries unless you understand the concept of Pro/3 facts (sentences).
|
||||||||||||
In a narrow sense - the entire
purpose of a Pro/3 application is to answer questions. Yet, this is of
course an over-simplification, firstly because it disregards the value of
the problem area insight gained in the process of building
the application; and secondly because Pro/3 has means of
extracting knowledge from the knowledge base without directly entering
questions e.g. by browsing through sentences, by generating reports etc.
Finally, a terminological note - questions are referred to as queries
i Pro/3, and this term is used in the following. (In the context of
inexact rules, question means something different - it means a
question asked the KE during the interpretation of a question-type data rule).
There are two classes of queries in Pro/3, that is, queries which return a set of sentences and queries which return a single value. In addition, there are few specialized queries which are more related to reports. |
||||||||||||
Sentence queries have the same structure as a sentence, with part(s) of the sentence made variable - either implicitly, by replacing part(s) of the sentence with variable(s) or by giving conditions to one or more of the data element types in the sentence. The main varieties are reviewed under: | ||||||||||||
1. A data element
type is variable:
2. All data
element types are left "open" for entity type manufacturer:
3. A combination of (1) and (2):
4. All data element types are left "open" for both entity types:
5. One entity type is a variable
6. Both entity types are variables
7. Condition on the price data element type
|
||||||||||||
The answers to the queries in the examples are shown in natural languange (NL) text format. A number of other formats are available (the query is which price ranges with lowest price<10000 are observed for which bike types?): |
||||||||||||
|
||||||||||||
While sentence queries return a set
of sentences, single-value queries return a single-value (and in some
cases a set of single values). Single-value queries are of great
importance because query-type inexact rules include one such query
- the rule uses the answer directly (or via a mapping) as its
return value.
The output format options do not apply to single-value queries, i.e. conversational NL is always used. |
||||||||||||
The response to a YES-NO-query is either of the identifiers YES or NO. The syntax is simply a sentence query prefixed with is it true that: | ||||||||||||
|
||||||||||||
The solution set size queries query the size (i.e. the number of sentences of a given type) in solution set, that is satisfying a specified sentence condition. The response is simply the number of sentences: | ||||||||||||
The operator # can be used in place of the number of:
|
||||||||||||
A data element reference query (or data element query for short), queries the value of a data element in a sentence or a set of sentences. The query exists in a deterministic and a non-deterministic variety. | ||||||||||||
In the above case there is only one sentence with price range for all-round bikes. The answer will be one value for each bike type, if bike type is left out:
Deterministic variety The prefix first can be used to limit the answer to only one value (the first sentence encountered in the knowledge base):
|
||||||||||||
It is also possible to query a function, i.e. a call to the function in the form of a query. The Pro/3 function faculty has one input parameter called integer: | ||||||||||||
Note that there are two alternative syntaxes for function calls e.g. given integer 5 and [integer=5].
The function today has no parameters. A non-deterministic function can return a set of values. The integer series function is a built-in function which generates a series of integers:
|
||||||||||||
The special queries under are actually reports from the point of view that no inferences are made to provide the answer. The answer is retrieved from the knowledge base without using the inference engine.
|
||||||||||||
All
About-query The All about-query is somewhere between a query and a report . The answer is the set of all sentences (of any type) where a given "tree" or "term" (typically a sub-tree corresponding to an identifier or a string), occurs. It is an "intelligent" variety of a GREP-function. There is also an All About-report, which additionally finds occurrences in non-sentence records (sentence rules, inexact rules and functions), besides having various input and output options. Two alternative syntaxes can be used: all about .... and what is known about ... |
||||||||||||
|
||||||||||||
The blank query is literally blank i.e. it is simply a question-mark. The answer is a list of all sentence types in the knowledge base. |
||||||||||||
|
||||||||||||
|
||||||||||||