Pro/3 is a system for processing knowledge, and Pro/3 deals with two main categories of knowledge - facts and rules. The purpose of this page is to look at queries (questions and answers) more closely.
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

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:

- which manufacturer with name X is located in the country with name Japan?

manufacturer with name Honda is located in country with name Japan! 
manufacturer with name Kawasaki is located in country with name Japan! 

The interrogative which in the query is actually optional, and the query can also be expressed as:

- which manufacturer with name X is located in which country with name Japan?
-
manufacturer with name X is located in the country with name Japan?

2. All data element types are left "open" for entity type manufacturer:

- which manufacturer is located in the country with name Japan?

manufacturer with name Honda is located in country with name Japan! 
manufacturer with name Kawasaki is located in country with name Japan! 

Example 1 and 2 are in effect the same, since the manufacturer entity type has only one data element type.

3. A combination of (1) and (2):

- which manufacturer is located in the country with name Y?

manufacturer with name Aprilia is located in country with name Italy! 
manufacturer with name BMW is located in country with name Germany! 
manufacturer with name Ducati is located in country with name Italy! 
manufacturer with name Harley - Davidson is located in country with name USA! 
manufacturer with name Honda is located in country with name Japan! 
manufacturer with name Husqvarna is located in country with name Italy! 
manufacturer with name Jawa is located in country with name Czech Republic! 
manufacturer with name Kawasaki is located in country with name Japan! 

4. All data element types are left "open" for both entity types:

- which manufacturer is located in what country?

manufacturer with name Aprilia is located in country with name Italy! 
manufacturer with name BMW is located in country with name Germany! 
manufacturer with name Ducati is located in country with name Italy! 
manufacturer with name Harley - Davidson is located in country with name USA! 
manufacturer with name Honda is located in country with name Japan! 
manufacturer with name Husqvarna is located in country with name Italy! 
manufacturer with name Jawa is located in country with name Czech Republic! 
manufacturer with name Kawasaki is located in country with name Japan! 

5. One entity type is a variable

which manufacturer is located in X?

manufacturer with name Aprilia is located in country with name Italy! 
manufacturer with name BMW is located in country with name Germany! 
manufacturer with name Ducati is located in country with name Italy! 
manufacturer with name Harley - Davidson is located in country with name USA! 
manufacturer with name Honda is located in country with name Japan! 
manufacturer with name Husqvarna is located in country with name Italy! 
manufacturer with name Jawa is located in country with name Czech Republic! 
manufacturer with name Kawasaki is located in country with name Japan! 
manufacturer with name Aprilia is located in world region with region name Europe! 
manufacturer with name BMW is located in world region with region name Europe! 
manufacturer with name Ducati is located in world region with region name Europe! 
manufacturer with name Harley - Davidson is located in world region with region name North America! 
manufacturer with name Honda is located in world region with region name Asia! 
manufacturer with name Husqvarna is located in world region with region name Europe! 
manufacturer with name Jawa is located in world region with region name Europe! 
manufacturer with name Kawasaki is located in world region with region name Asia! 

6. Both entity types are variables

what is located in where?

which will give the same answers as Example 5, since only manufacturers are located in somewhere. Note that the interrogatives act as variable. The query could also have been written X is located in Y? or what is located in X?

Five interrogatives are included in Pro/3's standard terminology: what, where, which, who and whom.

7. Condition on the price data element type

- which bikes have estimated current US$ price with price > 30,000?

bike with model "RSV-R Nera" has estimated current US $ price with price 44,642! 
bike with model "RSV Mille SP" has estimated current US $ price with price 44,421! 
bike with model "996R" has estimated current US $ price with price 33,172! 
bike with model "996 SPS" has estimated current US $ price with price 33,172! 

There are five comparison operators: =,>, >=, <= and <> (in addition to their synonyms equals, [is] greater than, [is] less than, [is] less or equal to, [is] greater or equal to and unequal).

RANGE COMPARISON OPERATOR

- which bikes have estimated current US$ price with 
price
in the range [13000, 13500>?

bike with model "R1150R Rockster" has estimated current US $ price with price 13,383! 
bike with model "Sporster 1200 Custom" has estimated current US $ price with price 13,383! 
bike with model "CBR600F/F-S" has estimated current US $ price with price 13,463! 
bike with model "Speed Triple" has estimated current US $ price with price 13,391! 
bike with model "Sprint ST" has estimated current US $ price with price 13,391! 
bike with model "YZF-R6" has estimated current US $ price with price 13,391! 

LIKE/UNLIKE COMPARISON OPERATOR

- which bikes with model like "R%" are listed?

bike model with name=Aprilia, price=25,000, currency=GBP, year=2004, rating=4, model="RSV-R Nera", type=sportsbike, cc=998, bhp=125, engine type=4 - stroke, cylinders=2, tank=18, weight=175, consumption=0.0 and top speed=160 is listed!
bike model with name=Aprilia, price=22,765, currency=GBP, year=2001, rating=0, model="RSV Mille SP", type=sportsbike, cc=996, bhp=135, engine type=4 - stroke, cylinders=2, tank=0, weight=0, consumption=0.0 and top speed=175 is listed!
bike model with name=Aprilia, price=11,425, currency=GBP, year=2004, rating=4, model="RSV Tuono Racing", type=sportsbike, cc=998, bhp=130, engine type=4 - stroke, cylinders=2, tank=18, weight=181, consumption=37.0 and top speed=160 is listed!
:
 

- which bikes with model like "R%" are listed?

bike model with name=Aprilia, price=25,000, currency=GBP, year=2004, rating=4, model="RSV-R Nera", type=sportsbike, cc=998, bhp=125, engine type=4 - stroke, cylinders=2, tank=18, weight=175, consumption=0.0 and top speed=160 is listed!
bike model with name=Aprilia, price=22,765, currency=GBP, year=2001, rating=0, model="RSV Mille SP", type=sportsbike, cc=996, bhp=135, engine type=4 - stroke, cylinders=2, tank=0, weight=0, consumption=0.0 and top speed=175 is listed!
bike model with name=Aprilia, price=11,425, currency=GBP, year=2004, rating=4, model="RSV Tuono Racing", type=sportsbike, cc=998, bhp=130, engine type=4 - stroke, cylinders=2, tank=18, weight=181, consumption=37.0 and top speed=160 is listed!
:
 

- which bikes with model like "%nord" are listed?

bike model with name=Aprilia, price=6,225, currency=GBP, year=2004, rating=3, model="Caponord", type=trailie, cc=998, bhp=98, engine type=4 - stroke, cylinders=2, tank=25, weight=215, consumption=32.0 and top speed=137 is listed!

- which bikes with model unlike "%r%" are listed?

bike model with name=Aprilia, price=22,765, currency=GBP, year=2001, rating=0, model="RSV Mille SP", type=sportsbike, cc=996, bhp=135, engine type=4 - stroke, cylinders=2, tank=0, weight=0, consumption=0.0 and top speed=175 is listed!
bike model with name=Aprilia, price=11,425, currency=GBP, year=2004, rating=4, model="RSV Tuono Racing", type=sportsbike, cc=998, bhp=130, engine type=4 - stroke, cylinders=2, tank=18, weight=181, consumption=37.0 and top speed=160 is listed!
:
 

 

QUERY OUTPUT FORMATS

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?):

NL TEXT FORMAT
TABULAR TEXT FORMAT (headers are optional)

DELIMITED FORMAT (headers are optional)

TABLE FORMAT

XML/NL

(XML/PR similar, but using KB-names rather than NL-names)

PR TEXT FORMAT

Single-value Queries

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.

 

YES-NO QUERY

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:

- is it true that a manufacturer is located in the country with name Japan?

YES

- is it true that a manufacturer with name BMW is located in the country with name Japan?

NO

 

SOLUTION SET SIZE QUERY

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:

- what = the number of manufacturers X which are located in country with name Japan?

2!

The operator # can be used in place of the number of:


- what = # X is located in Y?

16!

 

DATA ELEMENT REFERENCE QUERY

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.

- what=value of highest price where price range is observed for bike type with type=all-round?

20193 = value of highest price where price range is observed for bike type with type=all - round

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:

- what=value of highest price where price range is observed for bike type?

44421 = value of highest price where price range is observed for bike type
15024 = value of highest price where price range is observed for bike type
12388 = value of highest price where price range is observed for bike type
14624 = value of highest price where price range is observed for bike type
33172 = value of highest price where price range is observed for bike type
16722 = value of highest price where price range is observed for bike type
14781 = value of highest price where price range is observed for bike type
20193 = value of highest price where price range is observed for bike type

Deterministic variety

The prefix first can be used to limit the answer to only one value (the first sentence encountered in the knowledge base):

- what=first value of highest price where price range is observed for bike type?

44421 = first value of highest price where price range is observed for bike type  

 

FUNCTION QUERIES

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:

- what=faculty given integer 5?

120=faculty [integer=5]

Note that there are two alternative syntaxes for function calls e.g. given integer 5 and [integer=5].

- what=today?

24-APR-2004=today []

- what=no of days between [first date="2004-01-01" and second date="2005-01-01"?

366=no of days between [first date="2004-01-01" and second date="2005-01-01"]

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:

- what=integer series given start 1, end 10 and increment 2?

1=integer series [start=1, end=10 and increment=2]
3=integer series [start=1, end=10 and increment=2]
5=integer series [start=1, end=10 and increment=2]
7=integer series [start=1, end=10 and increment=2]
9=integer series [start=1, end=10 and increment=2]

 Special Queries

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 ...

- what is known about Harley-Davidson?

manufacturer with name Harley - Davidson makes bike with model "Hugger 883" ! 
manufacturer with name Harley - Davidson makes bike with model "Sportster 883" ! 
manufacturer with name Harley - Davidson is located in world region with region name North America ! 
manufacturer with name Harley - Davidson is located in country with name USA ! 
manufacturer with name Harley - Davidson has suitable bike with model "Hugger 883" with certainty - factor 4.6! 
manufacturer with name Harley - Davidson has suitable bike with model "Sportster 883" with certainty - factor 4.3! 

 

The Blank Query
 

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.

- ?

DB is in the KB
DB-configuration is in the KB
KB timing event is in the KB
KB-query is in the model
Pro/3 version is in the KB
annotation is noted
bike has Bike Magazine rating
bike has UK specifications
bike has cost factor
bike has estimated current US $ price
bike has metric specifications
bike has suitability ranking
bike has tank range
bike has type
:

 

- what is known about Harley-Davidson?

manufacturer with name Harley - Davidson makes bike with model "Hugger 883" ! 
manufacturer with name Harley - Davidson makes bike with model "Sportster 883" ! 
manufacturer with name Harley - Davidson is located in world region with region name North America ! 
manufacturer with name Harley - Davidson is located in country with name USA ! 
manufacturer with name Harley - Davidson has suitable bike with model "Hugger 883" with certainty - factor 4.6! 
manufacturer with name Harley - Davidson has suitable bike with model "Sportster 883" with certainty - factor 4.3!