OpenCyc Tutorial : An Introductory Walk Version 0.7 |
Contents
Step One: Find Relevant, Already-existing Constants
Step Two: Create New Constants
Step Three: Make Assertions On New Constants in your own Microtheory
Step Four: Testing in your own Microtheory
In this tutorial you will witness the creation of two new constants, and the making of some simple assertions on those constants.
Suppose that you have just acquired two kittens (who shall be referred to as "Billy" and "Peter") and they are so enchanting that you feel they should be represented in your version of the OpenCyc KB. Here is how one ontologist would go about such a process, described in first-person terms. I encourage you to follow me as I walk you through the steps I would take, using your browser. Ontological engineering - like any other engineering - is an intensely practical (albeit virtual), task which can really only be learned by doing it.
The process I will go through can be broken down into four main steps. Ok, let's begin.
First of all, I will try and find relevant, already-existing constants - constants that I will be able to use to make the assertions about Billy and Peter that I want to make. Of course I could create every constant I wish to use to talk about Billy and Peter, but why reinvent the ontological wheel? (Beware: this task is often harder than it looks...many a cyclist has torn out hair having just worked hard to create a new constant which they perceived as filling a hole in the ontology (say..."
First and most obviously, I guess I will want to say that Billy and Peter are kittens. That is probably the most salient piece of information I have about them. Is there a Cyc term that means "kitten"?
Enter the word "kitten" in the text field next to the "Complete" button in the top frame and click on the "Show" button...
Unfortunately this turns up nothing. There is no constant called
What does the '#$' in front of "#$Kitten" mean?
Maybe, instead of saying that Billy and Peter are kittens, I can say that they are juvenile cats. So now let's try "cat".
Enter the word "cat" in the text field next to the "Complete" button in the top frame and click on the "Show" button.
No luck there, either....In cases such as this, my next step will be to try something more general. Hmmmm....how about "pet"?
Enter the word "pet" in the text field next to the "Complete" button in the top frame and click on the "Show" button.
Cyc presents a choice of two constants:
DomesticPet NonPersonAnimal |
How does Cyc produce these two constants from a string ("pet") which is different than both of them? The answer lies with Cyc's 'natural language support'. For example, the KB contains the following two "assertions" (or facts) related to #$DomesticPet:
Mt : GeneralEnglishMt (denotation Pet-TheWord SimpleNoun 0 DomesticPet) M(multiWordString ("domestic") Pet-TheWord SimpleNoun DomesticPet)
The first assertion above relates the word "pet" to the Cyc constant "#$DomesticPet". The second on relates the phrase "domestic pet" to the same Cyc constant.
![]() |
Note: More specific collections 'inherit' the information that exists on the collections they are specializations of, and have further information as well. This hierarchy is ordered using the predicate #$genls. |
The Maxim Of Efficient Ontologizing: Be as specific as possible without being false. |
I should say that, strictly speaking, this maxim applies to the writing of individual assertions (which state facts) and not to the writing of rules (which allow Cyc to deduce things from the facts it knows). When it comes to rules, the more general you can be (without being false) the better! But this is an introductory tutorial and we will therefore be confining ourselves to individual assertions.
What are some other things I am likely to want to say about Billy and Peter? Well, another interesting fact about them is that they are brothers. Does this mean that, as was the case with
What's wrong with making a collection called #$Brother?
Billy and Peter are not just brothers per se, they are brothers of each other. Such relationships between two or more things are handled in Cyc using predicates rather than collections.
Specific relationships between two or more things are handled in Cyc using predicates rather than collections. |
Is there a predicate called
Enter the word "brothers" in the text field next to the "Complete" button in the top frame and click on the "Show" button..
No there is not.
Again, I realize that I better back up and try something more general. What is a more general version of the concept of brotherhood? Billy and Peter are...related to one another, i.e. they are relatives. Let's try "relatives"....
Enter the word "relatives" in the text field next to the "Complete" button in the top frame and click on the "Show" button.
Yes, there is a
From the "2 possible terms" page, click on the relatives link to get to view the details of
How do I use the Term Index Frame?
This presents a list of all the predicates which are direct specializations of
Mt : BiologicalSocialVocabularyMt (genlPreds grandchildren relatives) (genlPreds cohabitingFamilyMembers relatives) (genlPreds children relatives) (genlPreds coreRelatives relatives) Mt : BiologyVocabularyMt (genlPreds siblings relatives) (genlPreds biologicalRelatives relatives) |
![]() |
Note: Just as Cyc collections are arranged in an information-inheriting hierarchy ordered using the predicate #$genls, Cyc predicates are arranged in an information-inheriting hierarchy ordered using the predicate #$genlPreds. |
Tutorial lesson on predicates and the predicate hierarchy
Aha!
What else do I want to say about Billy and Peter? They like each other a lot (though they also roll around on the floor a lot biting each other...). So the next thing to do (which should not by now be too surprising) is to type in "likes", to see if there is some term (probably a predicate) I can use to say that Billy and Peter like each other.
Enter the word "likes" in the text field next to the "Complete" button in the top frame and click on the "Show" button.
You should see Cyc produce a constant with the somewhat bizarre name of
A constant with a name of the form "[X]-generic" tops a hierarchy of more specifically defined terms regarding [X]. |
In our case, obviously, [X] will be something to do with 'liking'). Such a term is often an 'umbrella term', designed to gather together more specific terms, rather than having actual assertions made on it. Let's therefore look for something more specific. With
The right frame should say "Predicate : likes-Generic" at the top. Scroll down in the right frame until you reach "comment:".
(likes-Generic SUBJ OBJ) means that SUBJ likes OBJ. This is a very general liking relation which is most useful for organising liking relations and for use during inference; for representation purposes, use a spec-Pred. |
So let's find the appropriate 'spec-Pred' (this is Cyc-talk for 'more specialized predicate') for
'Spec-Pred' is Cyc-talk for 'more specialized predicate'. |
Here we could just do what we did for
With #$likes-Generic still up , look at the left-hand frame, under Arg2, and click on "genlPreds".
You should see just one assertion:
Mt : AgentGVocabularyMt (genlPreds likesObject likes-Generic) |
What is this
Click on the word "likesObject" in the assertion.
Mt : AgentGVocabularyMt comment : "(likesObject AGT OBJ) means that when the sentient agent AGT is interacting in some way with OBJ, that agent feels some measure of Enjoyment --- that is, (feelsEmotion AGT Enjoyment). The kinds of interactions that produce Enjoyment depend largely on what kind of thing OBJ is. Thus, `Joe likes the Mona Lisa' implies that Joe feels Enjoyment when viewing the Mona Lisa. But `Joe likes pizza' implies that Joe feels Enjoyment when eating that kind of food. There are some specialized predicates of likesObject that give more information about the kind of interaction between AGT and OBJ that results in Enjoyment; see, e.g., #$likesSensorially and #$likesAsFriend." |
I'm not sure that I want to assert
In fact the answers are different for the two different predicates. The answer for
The Cyc constants you see which are not links were not made public and therefore do not exist in the OpenCyc KB. |
The answer for
#$genlPreds is a transitive predicate (i.e. if X is a spec of Y and Y is a spec of Z then X is a spec of Z). So there can be many more specs of a given constant than there are 'direct specs' (specs linked to that constant by specific assertions). |
There is actually a cool tool for viewing all the specs of a given constant, though. If you look slightly to the right of the "genlPreds", you will see a green plus.
Click on the green plus
slightly to the right of "genlPreds".
You should see the following:
Last query in AgentGVocabularyMt : (genlPreds ?ARG1 likes-Generic) 3 answers for ?ARG1 : likes-Generic likesAsFriend likesObject |
Now
Why does #$likes-Generic also appear in the list?
By the way, you probably noticed that as well as the green plus next to "genlPreds", there is also a red diamond
. This is in some ways an even cooler tool. You might like to click on it and see what it does....
So let's have a look at
Click on the word "likesAsFriend" in the main frame of the KB browser.
Mt : AgentGVocabularyMt comment : "(likesAsFriend AGT1 AGT2) means that AGT1 enjoys interacting socially with AGT2. See also the #$FeelingAttributeTypes Friendliness. Note: this predicate does not imply that AGT1 likes AGT2 only as a friend -- there may be romantic feelings, and other feelings, as well." |
This sounds more like Billy and Peter to me, if "interacting socially" is not just restricted to human society and also covers such activities as eating together and rolling around on the floor chewing one another's ears. This does seem plausible to me. To be sure, let's check what are called the 'argument-constraints' on
Look immediately above the comment I just quoted and find arg1Isa and arg2Isa.
In fact you just learned about). So I will use
Lastly, how about saying how old Billy and Peter are? They are currently 11 weeks old. Let's type in "age".
Enter the word "age" in the text field next to the "Complete" button in the top frame and click on the "Show" button.
There is an
Mt : BaseKB arg1Isa : SomethingExisting arg2Isa : Time-Quantity arg1Format : SetTheFormat arg2Format : IntervalEntry |
What does this mean? It means that the predicate .)
The "formats" of the two arguments are a somewhat more technical affair.
The
What exactly is a
Further reading on functions in Cyc
Let's browse the list of functions collected under
Enter the word "UnitOfTime" in the text field next to the "Complete" button in the top frame and click on the "Show" button.. When its definitional information appears in the main frame, look at the left-hand frame, under Arg2, and click on "isa".
You should see the following:
Collection : UnitOfTime GAF Arg : 2 Mt : BaseKB (isa DaysDuration UnitOfTime) (isa SecondsDuration UnitOfTime) (isa QuartersDuration UnitOfTime) (isa HoursDuration UnitOfTime) (isa WeeksDuration UnitOfTime) (isa DecadesDuration UnitOfTime) (isa YearsDuration UnitOfTime) (isa MonthsDuration UnitOfTime) (isa MinutesDuration UnitOfTime) |
Click on the word "WeeksDuration" in the main frame of the KB browser.
Its comment says:
"A UnitOfTime function that takes one or two real numbers as arguments and returns, as its value, a comparable Time-Quantity attribute measured in weeks. More precisely, an expression of the form (WeeksDuration NUM) denotes the ("point-value") Time-Quantity of being exactly NUM weeks in duration, and an expression of the form (WeeksDuration MIN MAX) denotes the (properly interval-like) Time-Quantity of being at least MIN weeks and at most MAX weeks in duration." |
What this means is that I can use "
Step One Summary: We have now identified the following constants which can be used to make assertions about Billy and Peter:
#$DomesticPet #$siblings #$likesAsFriend #$age #$WeeksDuration
In the previous step, we identified some constants which can be used to make assertions about Billy and Peter. Let's now create new constants to represent Billy and Peter themselves.
Before taking this step, if you are logged in as
You must be logged in as |
Let's start with Billy. Go to the Tools page and click on "Create".
Click on the Tools link in the left corner of the top frame.
The first thing to do is to choose a name for the new constant. "Billy" seems a logical choice. Of course if there were other Billys, Bills, etc. already in the KB, it might be wise to differentiate this constant a little further via its name. When this is desired, a Cyc convention is to append "-The[something]" at the end of a constant name (e.g.
To differentiate constants by name, a Cyc convention is to append "-The[something]" at the end of a constant name (e.g. |
Enter the word "Billy" in the main frame of the KB browser. Click on the "Create Constant" button.
Now, merely clicking on the button "Create Constant" is enough to give Billy a place in the ontology. I can now call up the
Let's now create
On the "Constant Create operation completed" page, click on the "Back to previous (stale) page" button.
Step Two summary - We now have two new constants, one for each kitten, on which we can start making assertions (or, as it is sometimes put, 'entering knowledge').
In the previous step, we created some constants that we will use as we make new assertions in Step 3. If you have not yet created those new constants, please go back and complete Step 2.
The next step is to make assertions in the KB using my new constants. Every Cyc assertion is made in some microtheory.
Every Cyc assertion is made in some microtheory. |
Tutorial lesson on microtheories
Note: At this point in the walk through, you have a choice to make. You can go through the quicker version that avoids (for now) some of the details about working with microtheories; or you can click here to use the more detailed version, where you will do some looking for the right microtheories to assert in and ask from. To use the shorter version of the walk through, just keep reading. The long version is 30-60 minutes longer than the short version.
In order to prepare for adding assertions to the KB, we're going to set up one new microtheory into which we will put all of our assertions about Billy and Peter. The microtheory will need to "see" all microtheories that contain assertions relevant to knowledge about Billy and Peter.
In Step One, we identified the following constants that we'll use to make assertions about Billy and Peter:
What are definitional assertions?
Now, let's quickly tell Cyc about our new microtheory, which we'll call "Cats-PracticeMt". First, go to the proper tool screen.
Click on the Tools link in the top frame.
This is where you can enter many assertions at one time in a kind of short-hand called KE Text format. Instead of typing in the assertions about our new microtheory by hand, you can copy and paste the assertions.
Copy all of the text from the shaded area below and paste it into the large text box on the Compose page. Make sure the box is checked next to "Remove non-printing characters in strings". Click the [Eval] button.
Default Mt: BaseKB. Constant: Cats-PracticeMt. isa: Microtheory. genlMt: BiologyMt HumanActivitiesMt AgentGMt. comment: "This microtheory is used by an OpenCyc 'walk through' exercise as a place to make assertions and ask questions about a few domestic cats.". |
The new page that comes up should contain the following sentence:
Your KE-Text (from ke-text compose) has been successfully parsed into the below lists. |
So now we're ready to add these assertions to the Agenda (which means that they'll be added to the KB).
Click the link that says, "Add Forms to Agenda".
You should see a new page that says:
KE-Text: Forms Added to Agenda |
These steps should have successfully created our new microtheory and connected it to other useful microtheories. There is one more thing we can do to streamline our work with microtheories. Let's make our new microtheory appear as the default choice when making assertions.
Click on the Tools link once again in the top frame. This will bring up the Tools page. Click on the "Options" link in the right column. This will bring up the Browser Options page. Scroll down to the section of the screen with the heading, "History and Browser Tool Options". Change the Default Mt on the right to read "Cats-PracticeMt" (without the quotes).
The page that comes up after you click on the [Change Options] button should say "KB Browser Options have been modified". Now, whenever you use the Assert tool,
Let's start making some assertions about Billy and Peter. We'll start by saying that Billy is a domestic pet.
Bring up the Assert page by clicking on the Tools link in the left corner of the top frame.
This should bring up the assertion-making tool. The "Assert" tool is used to make one assertion at a time. It is not the only way in which assertions can be entered in the KB, but it is the easiest and most straightforward.
The Assert tool is used to make one assertion at a time. It is not the only way in which assertions can be entered in the KB, but it is the easiest and most straightforward. |
Further reading on making assertions
With the "Assert Formula" page still up, enter
"
To confirm that the assertion has been entered into the KB, pull up the Term Content Screen for
Type "Billy" into the completion box in the top frame and hit the enter key on your keyboard.
Do you see the new assertion in the large frame on the right?
Now let's go ahead and make the same assertion on
Bring up the Assert page by clicking on the Tools link in the left corner of the top frame. Click on the "Assert" link in the column on the left. Enter
"
You can now try asserting that Billy and Peter are siblings, using the predicate
Let's go back to the Assert page and enter
Click on the "Back to previous (stale) page" button at the top of the main frame.
You now know how to check to see if that assertion has been added to the KB, so let's go on and assert that Billy is an animal.
Click on the Tools link in the left corner of the top frame. Click on the "Assert" link in the column on the left. Enter "(isa Billy Animal)" in the large text box.
Now let's do the same for Peter.
Click on the "Back to previous (stale) page" button at the top of the main frame.
Let's make another assertion with the predicate
Click on the Tools link in the left corner of the top frame. Click on the "Assert" link in the column on the left. Enter "(likesAsFriend Billy Peter)" in the large text box. Click on the "Cyclify" button. Click on the "Assert Formula" button.
Do I now also need to assert (likesAsFriend Peter Billy)?
Finally let's assert the ages of Billy and Peter by going back to the Assert page and, in the large text field, enter
Click on the Tools link in the left corner of the top frame. Click on the "Assert" link in the column on the left. Enter "(age Billy (WeeksDuration 11))" in the large text box.
Note the way in which the function
Finish asserting by clicking on the "Cyclify" button and then clicking on the "Assert Formula" button.
Now that you are familiar with one method of dealing with microtheories, you can either move on to Step Four to test what you've entered, or, if you would like a more detailed explanation of how to use microtheories and where to place assertions in the microtheory hierarchy, then read the considerably longer version of this walkthrough.
Step Three summary - we have now made a number of interesting assertions on our new constants
In the previous two steps, we created some constants (including a new microtheory called #$Cats-PracticeMt) and we made some new assertions. In Step 4, we'll be testing Cyc to make sure that the implications of those new assertions are there. If you have not yet created those new constants and/or assertions, please go back and complete Step 2 and Step 3.
We are not finished yet, however! A good engineer does not just design and build things, but also tests those things, to see if they are doing what they are supposed to do. Once again, ontological engineering is no exception.
Question: How does one test an ontology? Answer: Using the Cyc inference engine! |
We will now explore Cyc's question-and-answer functionality. Let's go back to the Tools page and click on "Ask".
Click on the Tools link in the left corner of the top frame.
As an ontological engineer, having finished making some assertions I will ask myself, what are some things that I would expect Cyc to know based on the information I've just entered? Of course I would expect Cyc to know
Let's ask.
Enter "(isa Billy SpatialThing)" in the large text box.
You should see the following:
Ask a Query [Skip to Inputs] Last query in Cats-PracticeMt : (isa Billy SpatialThing) Query halted because : Search space was exhausted. Query was proven True [Explain] |
Yes, Cyc does know that Billy is a spatial thing! How does Cyc know this?
Click on the link "Explain" (immediately above the line that separates the result of the query and the tools for asking another query).
This useful tool should produce the following:
Inference Answer Detail [Refresh] [Continue Ask] ------------------------------------------------------- Query in Cats-PracticeMt : (isa Billy SpatialThing) One Justification : :ISA (isa Billy SpatialThing) in Cats-PracticeMt |
"ISA:" is what is known as an HL module, a specialized inference-performing module of which Cyc has a great many. Clicking on it provides a summary of the particular inferences the module performed in this case.
Tutorial lesson on Inference in Cyc
Click on the link "ISA:", under One Justification :.
You should see the following:
HL Support Detail [Refresh] --------------------------------- Strength : Default Module : ISA Mt : Cats-PracticeMt HL Formula : (isa Billy SpatialThing) Justification : (isa Billy Animal) in Cats-PracticeMt (genls Animal AnimalBLO) in BiologyMt (genls AnimalBLO BiologicalLivingObject) in BiologyVocabularyMt (genls BiologicalLivingObject ComplexPhysicalObject) in BaseKB (genls ComplexPhysicalObject PartiallyTangible) in BaseKB (genls PartiallyTangible TwoOrHigherDimensionalThing) in BaseKB (genls TwoOrHigherDimensionalThing SpatialThing) in BaseKB |
Now, just out of curiosity, let's ask if Billy is a person, and see what happens. (What would you expect to happen?)
Click on the Back button on your web browser. This should take you to the Inference Answer Detail page. Click on the link "Continue Ask" in the upper right hand corner.
You should see the following:
Ask a Query [Skip to Inputs] Last query in Cats-PracticeMt : (isa Billy Person) Query halted because : Search space was exhausted. Query was not proven |
Why didn't Cyc say that this statement was false?
The Cyc inference engine never returns "false" -- but only "true" or "not proven" -- as the answer to a query. |
In fact the Cyc inference engine never returns false - only true or not proven. Cyc knows a great deal but has sufficient humility not to assume that
its failure to prove an assertion P is a sound basis for concluding that P
is false. However, let's try asking
Scroll down below "Query was not proven" on the "Ask a Query" page. The query we just asked is still entered into the fields there. Insert "(not" just before "(isa Billy Person)" and add another ")" at the end of the query, so that you have "(not(#$isa #$Billy #$Person))" entered in the large text box. Click on the "Cyclify" button. Click on the "Ask Query" button.
You should see this proven True! Why is this? Click on the link "Explain"....and again click on the link to the ISA: inference module.
Click on the link "Explain" (next to "True" and immediately above the line that separates the result of the query and the tools for asking another query).
You should see something that looks like this:
HL Support Detail [Refresh] --------------------------------- Strength : Default Module : ISA Mt : Cats-PracticeMt HL Formula : (not (isa Billy Person)) Justification : (isa Billy DomesticPet) in Cats-PracticeMt (genls DomesticPet DomesticatedAnimal) in HumanActivitiesMt (genls DomesticatedAnimal NonPersonAnimal) in DomesticBreedsVocabularyMt (disjointWith Person NonPersonAnimal) in BiologyMt |
This provides a summary of the inferencing which the :ISA inference module
went through in this case. Can you see what went on? Basically, it
followed the genls hierarchy from the collection
Note that it is not the case that every query which returns "Not Proven"
can be made to return "True" when negated. Consider, for example,
Click on the Tools link in the left corner of the top frame. This will bring up the "Browser Tools" page. Click on the "Ask" link in the column on the left. This will bring up the "Ask a Query" page. Enter "(isa Billy Dog)" in the large text box. Click on the "Cyclify" button (immediately above the large text box). Enter "Cats-PracticeMt" in the text box next to "Mt :". Click on the "Ask Query" button (immediately above the Mt : text box).
Click on the Tools link in the left corner of the top frame. This will bring up the "Browser Tools" page. Click on the "Ask" link in the column on the left. This will bring up the "Ask a Query" page. Enter "(not (isa Billy Dog))" in the large text box. Click on the "Cyclify" button (immediately above the large text box). Enter "Cats-PracticeMt" in the text box next to "Mt :". Click on the "Ask Query" button (immediately above the Mt : text box).
It turns out that Cyc cannot prove that Billy is or is not a dog. Cyc does
not know enough about Billy to decide either way. Of course if Cyc knew
that Billy were a cat then perhaps Cyc could decide this question. Remember
that we did not manage to assert that Billy and Peter were cats because
there was no
If you would like to, go ahead and create a constant
Now, if you are up to a challenge, see if you can make whatever
What else should we expect Cyc to be able to infer about Billy and Peter?
Here are some suggestions for further Asks:
Is Billy light enough to be carried around? (Can be proven True, under the right circumstances)
Have Billy and Peter ever met or come into physical contact? (Can be proven True, though this one is harder than the last! Hint: the relevant predicate may take some digging up.)
I encourage you to try doing some other asks, then making some other assertions, then doing still further asks....You are now on your way to becoming a Cyc-savvy ontological engineer. Have fun!!
Now that you hav completed the shorter versions of steps three and four, if you would like a more detailed explanation of how to use microtheories and where to place assertions in the microtheory hierarchy, then read the considerably longer version of this walkthrough.
Step four summary - we have performed some inference-testing and found out that Cyc does not only know what we told it in Step 3, it is able to make certain inferences based on that knowledge, which shows that it has integrated that knowledge into the larger KB.