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!
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.