// sure you get the HermiT library and add it to your class path. You
// can then instantiate the HermiT reasoner factory: Comment out the
// first line below and uncomment the second line below to instantiate
// the HermiT reasoner factory. You'll also need to import the
// org.semanticweb.HermiT.Reasoner package.
OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
// OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
// We'll now create an instance of an OWLReasoner (the implementation
// being provided by HermiT as we're using the HermiT reasoner factory).
// The are two categories of reasoner, Buffering and NonBuffering. In
// our case, we'll create the buffering reasoner, which is the default
// kind of reasoner. We'll also attach a progress monitor to the
// reasoner. To do this we set up a configuration that knows about a
// progress monitor. Create a console progress monitor. This will print
// the reasoner progress out to the console.
// ConsoleProgressMonitor progressMonitor = new
// ConsoleProgressMonitor();
// Specify the progress monitor via a configuration. We could also
// specify other setup parameters in the configuration, and different
// reasoners may accept their own defined parameters this way.
// OWLReasonerConfiguration config = new SimpleConfiguration(
// progressMonitor);
// Create a reasoner that will reason over our ontology and its imports
// closure. Pass in the configuration.
// OWLReasoner reasoner = reasonerFactory.createReasoner(ont, config);
OWLReasoner reasoner = reasonerFactory.createReasoner(ont);
// Ask the reasoner to do all the necessary work now
reasoner.precomputeInferences();
// We can determine if the ontology is actually consistent (in this
// case, it should be).
boolean consistent = reasoner.isConsistent();