2.7 Queries with logical operators

The logical connection "and" denoted in F-Logic as  "," is default in our diagram language. If a query has only this type of connection  we will not show  "and" explicitly on the diagram, and keep single nodes for  the variables with the same name.

?-roel[owns-->>X],  tiny[owns-->>X].

"Find all those X which are owned by roel and tiny  both".

The queries of the former type are most common.  And they have fair and intuitive representation in GFL. Yet sometimes  (not too often indeed) we will need to make queries that have more complex logical structure. Here are the examples:

?-roel[owns-->>X]; tiny[owns-->>X].     (NOTE  - semicolon  ';' stands for OR)

"Find all those X which are owned either by tiny OR by roel". Here variable name X is used as a mean to connect two different parts of query. To show clearly  the tree structure of the query on the diagram we will use two distinct nodes for such variables. Although we will connect them with  dotted or yellow  line. Alternatively we may use a single node for all occurrences of the same variable.

 

 

 

?-roel[owns-->>X], not tiny[owns-->>X].

"Find all those X which are owned by roel but not owned by tiny ".

 

Top     |  Previous   |   Next (Rules)

 

 

 

 

C 2003 S. Krivov  Send your comments to skrivov@zoo.uvm.edu