sync_reasoner() interface to HermiT

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

sync_reasoner() interface to HermiT

lars
Hello,

I started using owlready2 in one of my recent projects and so far it has been a really useful API! Thanks!

Mainly, I have been using features for mixing Python and OWL, and for reasoning (via HermiT) which works nicely.

However, I noticed that the API calls the HermiT reasoner as a subprocess (via the command-line interface), parses the results, and asserts them back into the ontology and Python.

Unfortunately, that limits the reasoning capabilities of HermiT as not all functionalities are available from command-line. In particular, I am interested in reasoning about the so-called OBJECT_PROPERTY_ASSERTIONS; that is object properties that are asserted to individuals during reasoning (e.g. via SWRL rules).

To this end, my idea was to adapt the sync_reasoner() function so that it either (i) interacts with the HermiT API directly (via some python-java API) or (ii) calls a custom Java class (via the command-line) which uses the HermiT API with more options.        

Does either of these two options make sense? Or can you think of a better way for enabling this kind of reasoning?

The result could either be parsed from the output (as it is now) or it could be re-loaded from a file. What do you think about the second option, ie, saving the inferred ontology and re-loading it? Would this be possible or break anything? In particular, I am not sure if this would work with the 'with onto: sync_reasoner()' way. Any thoughts on this? Any pointers would be very much appreciated!  

Many thanks,

Lars
Reply | Threaded
Open this post in threaded view
|

Re: sync_reasoner() interface to HermiT

Jiba
Administrator
Hello,

Thank you for your feedback on Owlready!

I do not understand what kind of reasoning you want to do with OBJECT_PROPERTY_ASSERTIONS, but I think your second option is the better one. I already followed a similar approach, because the Hermit command line was limited and did not allow to obtain the individual classification in the standard output. Thus, I modified the CommandLine.java class (you can find it in Owlready sources, in the hermit/org/semanticweb/HermiT/cli subdirectory). So, you need to add a new command line option for OBJECT_PROPERTY_ASSERTIONS, and possibly to print the result on the standard output and read it in Python.

"with onto: sync_reasoner()" just means that any inference produced by the reasoner will be asserted in the "onto" ontology. Unless you want to assert the infferred fact in different ontologies (e.g. depending of the type of fact), I think it's OK.

Jean-Baptiste Lamy
Reply | Threaded
Open this post in threaded view
|

Re: sync_reasoner() interface to HermiT

lars
Great, thanks for your quick reply. I will try to extend the CommandLine class then.

The OBJECT_PROPERTY_ASSERTIONS option reasons about object properties between individuals and will assert them if they hold. For example:

Asserted properties:
in(book, box),
in(box, cupboard)

SWRL rule:
in(?X, ?Y), in(?Y, ?Z) -> in(?X, ?Z)

Inferred object property:
in(book, cupboard)

thanks
Lars
Reply | Threaded
Open this post in threaded view
|

Re: sync_reasoner() interface to HermiT

Hermi
Hi!

I'm also interested in this topic. Could you explain me how you solved it at the end?

Thanks in advance :)