## Basic Queries

E-Mail Comments to: opencyc-doc@cyc.com
Copyright© 1996-2002 Cycorp. All rights reserved.

| Querying CYC® with the Web Interface
| Queries within Microtheories

On the CYC® Navigator page, under the "Browsing and Editing" heading click `[Ask]` to go to the page for the Ask facility. Links to this page are also available from many other pages displayed by the CYC® Web Interface.

On the Ask page, the input windows correspond to the arguments of CYC-QUERY, the basic CYC® interface function for making queries. The first input window is a long horizontal region marked `Mt:`. Enter the microtheory in which you wish the ask to be performed, e.g. #$InferencePSC, here. Immediately below you will notice a large text area marked `Formula:`, where you can enter a CycL query formula. After entering appropriate text in these input windows, clicking the "Ask Query" button generates a call to CYC-QUERY and the result is displayed on a new Ask page (making it easy to ask a series of queries).

The rest of the input windows default to reasonable values, so let's ignore them for a moment and try writing some queries.

A CycL query formula is a CycL expression in which some terms are variables. Querying with that formula instructs the inference engine to find sets of terms which, when substituted for the variables, make the formula true. These sets of terms are referred to as "bindings": each term is "bound" to one of the variables. A set of bindings which makes the query formula true is said to "satisfy" the query.

For example, consider the formula:

         (#$genls ?X #$Dog)

When used in a query, the inference engine will try to find bindings for ?X which would make the proposition true, i.e. collections which are subsets of #$Dog, the collection of all dogs.

Notice that we used "?X" for a variable name, rather than "X". Variables in CycL expressions must begin with "?". After typing in

    #$InferencePSC

(#$InferencePSC is a a problem solving context in which all assertions in the entire KB are initially visible) into the `Mt:` input window and typing the expression

    (#$genls ?X #$Dog)

into the `Formula:` input window, click the "Ask Query" button. In a KB with the proper knowledge, the interface would display a page with information such as:

        [Explain #1]  Dog
        [Explain #2]  Hound)
        [Expalin #3]  Setter-TheDog)
        [Explain #4]  EnglishSetter)
          ...

Note that the exact values depend on the particular constants and assertions in your KB. The possible bindings for ?X are returned as a list with links to the justifications for each binding.

Last Update: 03/25/2002