Feed and generalize (python)
Do the birds fly ?
Presentation of the problem
This is the third tutorial! Now that we have seen what is an ontology manipulator, the exploration of heritage, the management of the language, the passage in natural language, and the use of properties. Now, it might be useful to stop using a static knowledge base and see how to insert new knowledge dynamically. At the same time, we will take the opportunity to see the use of reasoner and more particularly that of generalization.
The mini-project that we will do together to illustrate the insertion of knowledge will consist of a chatbot.
If I ask you if the birds can fly, you will answer me suddenly that yes. However, some will say that the kiwi, although being a bird, can not fly and you will be right. If now I ask you if the phalarope, which is a bird, is able to fly, what will you tell me? If like me you do not know this bird, you will surely tell me that a priori, being a bird, it should be able to fly. With the mechanism of addition of knowledge and thanks to the reasoning of generalization, we will reproduce this type of reflection.
The ontology used
For this tutorial, we will not use existing ontology because we will fully create it dynamically.
Before you start
Before moving on, you can create a new launch file, set the "files" argument with an empty quotation mark to make sure you do not load an existing ontology, and then set the "intern_file" argument to a file named "birds.owl".
Let's call this file generalize.launch and put it in our package in the folder launch.
Let's call this file generalize.xml and put it in our package in the folder launch.
Let's call this file generalize.py and put it in our package in the folder launch.
Let's call this file generalize.yaml and put it in our package in the folder launch.
By specifying an internal file, Ontologenius is allowed to save the ontology it contains in a file when it is stopped and to reload it on its next start. We will see the usefulness of this later.
You should also have noticed that we have used a new argument "config_file". With it, we can configure the reasoners we want to activate at the launch of Ontologenius and also tune their parameters. You can find more information about this file here.