        import org.semanticweb.owlapi.apibinding.OWLManager;
	import org.semanticweb.owlapi.io.*;
	import org.semanticweb.owlapi.model.*;
        import org.semanticweb.owlapi.reasoner.*;
	import org.semanticweb.owlapi.util.SimpleIRIMapper;
        import org.semanticweb.owlapi.util.DefaultPrefixManager;
        import java.util.Iterator;
        import java.util.Set;
	import java.io.File;
	import java.io.FileNotFoundException;
	import java.io.IOException;
	import java.net.URI;
	import java.net.UnknownHostException;
	import java.util.Map;
        import org.semanticweb.HermiT.Configuration;
        import org.semanticweb.HermiT.Reasoner;
        import org.semanticweb.HermiT.Configuration.TableauMonitorType;

public class ontology2 {
    public static void main(String[] args) {

       try {
         
       OWLOntology animal;
       OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
       OWLDataFactory dataFactory = manager.getOWLDataFactory();
       IRI iri = IRI.create("http://www.test.com/ontologies/testont.owl");
       File file = new File("C:/Users/Syed/Desktop/animal.owl");
       animal = manager.loadOntologyFromOntologyDocument(file);
       manager.addIRIMapper(new SimpleIRIMapper(iri, IRI.create(file)));
       IRI ontologyIRI = IRI.create("http://www.test.com/ontologies/testont.owl");
       animal = manager.loadOntology(ontologyIRI);
       OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
       ConsoleProgressMonitor progressMonitor = new ConsoleProgressMonitor();
       OWLReasonerConfiguration config = new SimpleConfiguration(progressMonitor);
       OWLReasoner reasoner = reasonerFactory.createReasoner(animal,config);
       reasoner.precomputeInferences();
       boolean consistent = reasoner.isConsistent();
       System.out.println("Consistent: " + consistent);
       System.out.println("\n");
       OWLDataFactory fac = manager.getOWLDataFactory();
       PrefixManager pm = new DefaultPrefixManager("http://www.test.com/ontologies/testont.owl");
       OWLClass animals = fac.getOWLClass(":animal", pm);
       NodeSet<OWLClass> subclasses = reasoner.getSubClasses(animals, true);
       Set<OWLClass> classes = subclasses.getFlattened();
       System.out.println("Subclasses of animals: ");
       for(OWLClass clas : classes) {
       System.out.println("    " + clas);
       }
       System.out.println("\n");
       }

    catch (OWLException e) {
       e.printStackTrace();
       }
    }
}
