## Ask a Query Help

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

Ask a Query is a versatile tool that enables users to ask questions of CYC®in standard CycL syntax. Anyone who needs to know more about CycL syntax should read The Syntax of CycL.

### Asking a Query

Every CycL query is asked in some microtheory (Mt). The Mt window on the Ask a Query page has a default entry of "Base KB", which may be edited. It doesn't matter whether the Mt name is typed with or without "#$" before it.

The CycL query is entered into the Formula input window. In the Formula window, constant names require their "#$" prefixes. The [Cyclify} button tells the interface to automatically add "#$" before each constant. Pressing the [Complete] button next to either the Mt or Formula window finishes a partially typed constant name in the respective window. (In the Formula window, Complete works only on the last term in the window.) If the typed string has multiple completions, Complete displays a list of possible choices in a separate Completions window.

Clicking on the [Ask Query] button queries Cyc® about the formula in the microtheory specified.

### Query Results

When the query is finished, Query Results appear on a fresh Ask page. Together with the Query results, Cyc® displays the query just asked, the microtheory in which it was asked, and the reason for halting the query. The arrangement looks like this:

            Last query in BaseKB:
            (genls ?X Animal)

            Query halted because:  Search space was exhausted.

Query results come in several forms, depending upon the form of the original query. Also, the contents of Query results may vary depending upon changes in the Inference Resource Constraints (see below); for now, assume the default settings.

(1)GAFs: If the query formula contains no variables, CYC® will return the truth value of the formula (in the specified microtheory). For example,

    	Mt: HumanActivitiesMt
    	Formula: (#$isa #$Foo #$Bar)

will return "Query was proven True" if #$Foo is an instance of #$Bar in the #$HumanActivitiesMt. Otherwise, it will return "Query was not proven". Here's an actual result:

            Last query in BaseKB:
    	(genls Dog NonPersonAnimal)

    	Query halted because:  Search space was exhausted.

    	Query was proven True

(2) Query formulas having free variables: If the formula contains one or more free variables, then CYC® will return any bindings it can find for the variable(s) (within the specified microtheory). For example,

    	Mt:  HumanActivitiesMt
    	Formula:  (#$isa ?X #$Bar)

will return all elements of #$Bar found in the #$HumanActivitiesMt. If there are none, it will return "Query was not proven". Here's an actual result:

    	Last query in InferencePSC:
    	(genls ?COL Dog)

    	Query halted because:  Search space was exhausted.

`20 Answers` |  | ?COL
[Explain #1] |  | NonPersonAnimal
[Explain #2] |  | Vermin
[Explain #3] |  | TameAnimal
[Explain #4] |  | DomesticatedAnimal
[Explain #5] |  | DomesticPet
[Explain #6] |  | Dog
[Explain #7] |  | (FemaleFn Dog)
[Explain #8] |  | (JuvenileFn Dog)
[Explain #9] |  | WildAnimal
[Explain #10] |  | Invertebrate
[Explain #11] |  | Arthropod
[Explain #12] |  | Insect
[Explain #13] |  | OviparousAnimal
[Explain #14] |  | Bird
[Explain #15] |  | (FemaleFn Bird)
[Explain #16] |  | CanineAnimal
[Explain #17] |  | Amphibian
[Explain #18] |  | Reptile
[Explain #19] |  | HerdAnimal
[Explain #20] |  | Fish

(3) Existentially bound query formulas: If the formula is within the scope of an existential quantifier, and there are no free variables, then CYC® will return "Query was proven True" if the formula is true in the specified Mt. For example,

    	Mt:  HumanActivitiesMt
    	Formula:  (#$thereExists ?X (#$isa ?X #$Bar))

will return "Query was proven True" if CYC® finds any instance(s) of #$Bar in the specified microtheory. Otherwise, it will return "Query was not proven". Here's an actual result:

    	Last query in BaseKB:
    	(thereExists ?X
    	   (genls ?X NonPersonAnimal))

    	Query halted because:  Search space was exhausted.

    	Query was proven True

The details of CYC®'s search path for a particular query may be obtained by clicking on the link that follows "Query halted because". In this case, you'd click on the link that says "Search space was exhausted." (On a plain Ask page (without results), the link for "Examine the previous inference..." goes to the inference tree for the previous query.)

Below the Query results is an Ask setup containing the query just asked. To continue that query (e.g., to give it a longer total time), click on [Continue Last Query]. This will start the second query where the first left off.

The [Reset Values] button is used to restore the text in the Mt and Formula windows to whatever it was when the windows first appeared.

### Inference Resource Constraints

The size of the search space, the time allotted for the query, the number of bindings sought, and whether or not backchaining may occur can all be manipulated in the Inference Parameters section of the Ask a Query page. For more information on resource constraints, see Help for Inference Resource Constraints.

To reach a set of inference/ask settings for advanced users, click on the [Show] button to the left of "Advanced Inference Parameters".

For more details about asks, reasons for halting queries, and troubleshooting with resource constraints, consult the module entitled Querying CYC® with the Web Interface in the CYC® Course Materials.

Go to Top