// load an ontology from the web
IRI iri = IRI.create("http://www.co-ode.org/ontologies/pizza/pizza.owl");
OWLOntology pizzaOntology = manager.loadOntologyFromOntologyDocument(iri);
// create a reasoner, many reasoner realize the OWLReasonerFactory interface,
// e.g. pellet, FaCT++, Hermit
OWLReasonerFactory reasonerFactory = (OWLReasonerFactory) Class.forName("com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory").newInstance();
Reasoner reasoner = reasonerFactory.createNonBufferingReasoner(pizzaOntology);
// traverse in OWLOntology
// get OWL_THING
IRI classIRI = OWLRDFVocabulary.OWL_THING.getIRI();
OWLClass clazz = manager.getOWLDataFactory().getOWLClass(classIRI);
// get subclasses.
Set
// check satisfiability of clazz
reasoner.isSatisfiable(clazz);
没有评论:
发表评论