这是使用 Java OWL API 执行一致性检查的方法:
/*Load your ontology from a local file and do the initialisations*/
File inputfile = new File("ontologyPath");
OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); ;
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLOntology yourOntology = manager.loadOntologyFromOntologyDocument(inputfile);
IRI ontologyIRI = yourOntology.getOntologyID().getOntologyIRI();
/* Load a reasoner, the default one that comes with the OWL API is HermiT.
However, You can use other reasoners, such as Fact++ or Pellet, by
downloading their libraries and adding them to your project build path */
OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
OWLReasonerreasoner = reasonerFactory.createReasoner(yourOntology);
/* Perform consistency check */
boolean consistency = reasoner.isConsistent();
还可以查看OWL API网站上的示例。
贝尔坎