![]() | Viewing Cyc® Constants with the Web Interface |
![]() | Other References |
The constant name grep facility is much faster and can perform much more specific searches than constant completion, so you might wonder why anyone would ever use constant completion. The answer is that constant name grep operates on a static file of constant names which is only updated when the KB world is built. So it can miss constants which have been created or renamed since the last world build. Constant completion, on the other hand, consults an internal Cyc® datastructure which is always up-to-date. Whether this is important depends on what you are looking for, but for general exploration of the KB, constant name grep is usually a better choice.
In the top frame, there are three buttons to the right of the type-in pane. The third one is labeled GREP. To search for constants, enter a UNIX regular expression in the field and click the GREP button. The browser will display a page listing the constants whose names match the expression. Clicking on one of the listed constants will display it. If there is only one matching constant, the browser will automatically display that constant's page.
Important Note: Grep is not effective for searching for newly created constants. The grep facility searches a list of constants, not your current image. This list is generated at world build time and therefore will miss constants created after that list is created. If you can't locate a constant using grep, it is almost certainly because the constant was too recently created to be included in the latest version of the constant list. Also do not be surprised if recently killed constants still show up with the grep tool.
If you are not familiar with UNIX regular expressions, this may seem a little arcane, so here is a quick guide to some commonly used expressions:
Examples | |
---|---|
Expression | Result |
.* | all constants |
en.* | those beginning with "en" |
.*-TheWord | those ending with "-TheWord" |
.*device.* | those containing "device" |
.*[fd]og.* | those containing "fog" or "dog" |
".*" (period-asterisk) is used instead of "*" (a single asterisk) because an asterisk can be a character in a string; in this case, "." is an escape character for "*".
UNIX regular expressions have many more possibilities. Look at the UNIX man page for grep to see a complete (though rather terse) specification of regular expression syntax.
There is also a small button next to the grep button marked "Ignore Case". When this option is selected a case insentive grep is performed. When it is not selected a case sensitive grep is performed.
To search for constants starting with a particular string, enter the string in the input field and press the complete button. A window will pop up with the possible completions in it. Each completion will be a clickable link that will bring you directly to the page for that constant. If there is only one completion, the page for that constant will automatically be displayed.
Note that constant completions are case sensitive.