Code Samples

Example usage of Cyc APIs:

Basic Core API usage
An introduction to looking up facts in the KB, adding new facts, and performing basic queries.
Advanced querying
A set of examples focused on more advanced uses of the com.cyc.query class.
Query construction
Examples of how to combine query ‘fragments’ into a larger, coherent query. (Not supported for OpenCyc.)
Query searching
Constructing queries starting from English text using the com.cyc.km.query.construction.QuerySearch class. (Not supported for OpenCyc.)
Query justification
How to traverse the assertions that are used to produce a particular answer to a Cyc query. (Not supported for OpenCyc.)

You may also download these code samples from the Cyc API Examples repository.