5

We have an ontology but we need to use the reasoner HermiT to infer the sentiment of a given expression. We have no idea how to use and implement a reasoner in python and we could not find a good explanation on the internet. We found that we can use sync_reasoner() for this, but what does this do exactly? And do we have to call the reasoner manually everytime or does it happen automatically?

K. Project
  • 112
  • 7

1 Answers1

3

You do not need to implement the reasoner. The sync_reasoner() function already calls HermiT internally and does the reasoning for you.

A reasoner will reclassify individuals and classes for you which means it creates a parent-child hierarchy of classes and individuals. When you load an ontology only explicit parent-child relations are represented. However, when you call the reasoner, the parent-child hierarchy is updated to include inferred relations as well.

An example of this is provided in Owlready2-0.5/doc/intro.rst. Before calling sync_reasoner() calling test_pizza.__class__ prints onto.Pizza, which is explicit information. However, after calling sync_reasoner() calling test_pizza.__class__ prints onto.NonVegetarianPizza, which is the inferred information.

Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
  • Hi, does sync_reasoner() function check consistency for an ontology? – Bayzid Jul 03 '18 at 06:08
  • Yes, consistency checking is part of the reasoning process. – Henriette Harmse Jul 03 '18 at 06:16
  • Thank you for replying. I am facing difficulties in tracing the output. I have one ontology which contain error because I have put Student and Unit as a disjoint class and as well as equivalent class to see what output hermit gives me. But it shows same output for both correct and incorrect file. Please have a look on this question. https://stackoverflow.com/questions/51147628/consistency-checking-using-hermit-reasoner-in-python-for-an-ontology Thanks in advance. – Bayzid Jul 03 '18 at 06:49