2.6 Variables and Queries

In F-Logic the queries are expressed with the help of free variables. There is a convention that variable name starts from a capital letter or underscore.

Here are examples of  simple query:

?-X:ecologist.  

This means: "Find all known instances of ecologist".

 In this notations  we want to preserve information about object/classes and attributes. We want to see from the graph weather variable stands for object/class or attribute:  In these notations we recognize variables by the question mark at the end of its name and green color. In the end we will have to stick to one of the alternatives and most likely we will stick to the green one.

 

 

Here is another example:

?-roel:ecologist.                                            

"Check if roel is an instance of class ecologist"

 

 Here is the query related to the value of an attribute. You can read it as "find all X which roel owns".

?-roel[owns->>X].

Here is a graphic representation of the same.

 

F-Logic allows to query the attributes;

?-roel[Attr->V]

This says "Find all single valued attributes Attr of object Roel along with their values V".

        

F-Logic allows to query the signatures:

?-personl[Attr=>C]

This says "Find all single valued attributes Attr specified for the class person along with the classes C of attribute contents". Here is the graphic form:

 

 

 

Top   | Previous | Next

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