I have two questions:
How can I make my ontology public (which is created in Protege) that I am reading in OWL API to use in other functions of the same or different classes. I only want to make my code smarter so that I dont have to declare the ontologies again and again in every function or class. I am also attaching an image to further specify my questionenter image description here
I want to reason (or query) in between number of ontologies. I am able to query with the reasoners (DL and HermiT) but I am confused which one to use?
In order to make a local variable public and visible from multiple methods, you just declare it as a public member variable. This is achieved simply changing the access modifier to public.
DL is not a reasoner implementation, as far as I know.
HermiT implements a DL reasoner and it also supports SWRL rules. It can be used through a Protege plugin, or through code by using it as an OWLReasoner
.
Example:
OWLOntology o = ...
OWLReasoner hermit= new Reasoner.ReasonerFactory().createBufferedReasoner(o);
The `hermit` object is ready to be queried now.