Ontoros.get_logger().info('The difference of belief regarding the ball_1 is:')
fordiffindifferences:
Ontoros.get_logger().info(diff)
if__name__ == '__main__':
main()
First of all a small trick.
onto.get('anne').feeder.waitConnected()
If you know ROS, you should know that subscribers may take a few moments to connect to listeners. Because, again,
our program is a bit too fast, this connection may not be effective immediately. To avoid this problem, you can use
the previous lines to make sure that our feeder is connected to at least one listener.
Here are really the two lines that represent the fact that Anne removes the ball from the first container and puts it
in the second container. You see here that these changes are applied only to Anne.
onto.get('anne').feeder.waitUpdate(500)
With the waitUpdate function, we will wait until the previous changes are applied. For security reasons, we set a timeout of 500 ms.
The OntologiesManipulator object directly provides functionality to get all the belief divergence between two ontologies about a specific concept.
Run the code with the launcher created previously. You should have this result at the end:
for sally, ball_1 is in : ['container_1']
for anne, ball_1 is in : ['container_1']
The difference of belief regarding the ball_1 is:
[-]ball_1|isIn|container_2
[+]ball_1|isIn|container_1
You can see from this display that the result of the getDifference function is really a difference, as in the mathematical
sense. This can be read as the fact that "ball_1 isIn container_1" is present in Sally's base and not in Anne's and that
the fact that "ball_1 isIn container_2" is not present in Sally's base then that it is in Anne's.
Now kill the previous process and restart it. This time, you should have this:
for sally, ball_1 is in : ['container_1']
for anne, ball_1 is in : ['container_2']
The difference of belief regarding the ball_1 is:
[-]ball_1|isIn|container_2
[+]ball_1|isIn|container_1
You can see two things here. First, the ball was already in the second container for Anne at first. Secondly,
even though we added the fact that the ball_1 is in the second container when it was already the case, the fact
only appears once.
If you open the ontologenius_tutorial folder, you should have two new files, multi_anne.owl and multi_sally.owl.
These two files are Ontologenius internal files. Remember that the intern_file argument has been set to
"multi.owl". In fact, multi can simply be considered a namespace that will be used to create the
names of internal files.