Use inheritance for my first program (pyhton)
Who is the intruder ?
Launch the program
Perfect, we now have an early program that, while not doing much, is functional. It is therefore time for us to launch our program as well as Ontologenius. One way that will seem obvious to us will be to launch our two programs independently like this:
terminal 1:
terminal 2:
However, Ontologenius has three launch parameters and by doing so we take the default parameters that are not necessarily the ones we need. Let's detail the parameters available:
- language: That's what we call the working language. Ontologenius makes it possible to link natural language words to computer identifiers and vice versa. It is precisely the natural language part that will be impacted by this language parameter. We will see in detail its effect and its uses at the end of this tutorial.
- intern_file: Ontologenius allows for long-term learning by coming to store its current knowledge in a file of its own and that we do not have the vocation to modify as a user. This own file is precisely intern_file. To avoid using an internal file, simply set the none value to a path.
- files: These are the input files, those that will be loaded at the launch of Ontologenius. Be careful though, these files are not taken into account if you use an internal file and this file already contains knowledge.
Now that we've seen the parameters, let's look at the launch files that are available and that we can re-use.
- ontologenius: It defines the working language as being English, it also defines an internal file and some input files to be able to realize some tests quickly.
- ontologenius_empty: It defines the working language as being English, it also defines an internal file but does not define any input files.
- ontologenius_full: The parameters are the same as for ontologenius. The only difference is that the Ontologenius GUI (ontoloGUI) is also launched.
For our application, we do not need the GUI so we will ontologenius or ontologenius_empty. Indeed, we can use one or the other because we will in all cases redefine our own parameters.
Let's create our launch file that will launch our application as well as Ontologenius with our parameters:
Let's call this file intruder.launch and put it in our package in the folder launch.
Let's call this file intruder.xml and put it in our package in the folder launch.
Let's call this file intruder.py and put it in our package in the folder launch.
Let's call this file intruder.yaml and put it in our package in the folder launch.
We can see that we used the launch file by redefining the internal file to not use it and putting the ontological file of this tutorial as an input file.
The ontology is given here, but you can also create your own ontology with protégé. Just think about exporting your ontology in XML / RDF format.
You have no more things to do. This block is only for ROS2 users. Take a break and just think about them struggling with ROS2.
Edit your setup.py file with the following. The two new lines will install every launch files put in the launch folder and will install your new node.
Do not forget to compile in order to install everything!
I believe we are ready to launch our program:
If all went well, you should have at the bottom of your terminal a section of which summarizes the number of classes, individuals, and property that were loaded from the input file. As a result of this, you should find the "Let's play" that we have code together. This summary is generated following the closure of the ontology. It is there to let you know what Ontologenius has taken into account. Also, if you scroll a little upwards, you can observe the complete arborescence of those read by Ontologenius.
So let's check if our topic works well with the following publications:
Then ask to start the reasoning:
You should have the following output that corresponds to the summary and loopback of the program.