public Set<Set<OWLAxiom>> getEntailmentExplanations(final OWLAxiom axiom) { final OWLClassExpression unsatClass = _converter.convert(axiom); return getUnsatisfiableExplanations(unsatClass); }
public Set<OWLAxiom> getSubClassExplanation(final OWLClassExpression subClass, final OWLClassExpression superClass) { final OWLSubClassOfAxiom subClassAxiom = _factory.getOWLSubClassOfAxiom(subClass, superClass); return getEntailmentExplanation(subClassAxiom); }
public Set<Set<OWLAxiom>> getInstanceExplanations(final OWLIndividual ind, final OWLClassExpression cls) { final OWLClassAssertionAxiom classAssertion = _factory.getOWLClassAssertionAxiom(cls, ind); return getEntailmentExplanations(classAssertion); }
public void run() throws OWLOntologyCreationException, OWLException, IOException { PelletExplanation.setup(); // The renderer is used to pretty print clashExplanation final ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); // The writer used for the clashExplanation rendered final PrintWriter out = new PrintWriter(System.out); renderer.startRendering(out); // Create an OWLAPI manager that allows to load an ontology file and // create OWLEntities final OWLOntologyManager manager = OWL._manager; final OWLOntology ontology = manager.loadOntology(IRI.create(file)); // Create the reasoner and load the ontology final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); // Create an clashExplanation generator final PelletExplanation expGen = new PelletExplanation(reasoner); // Create some concepts final OWLClass madCow = OWL.Class(NS + "mad+cow"); final OWLClass animalLover = OWL.Class(NS + "animal+lover"); final OWLClass petOwner = OWL.Class(NS + "pet+owner"); // Explain why mad cow is an unsatisfiable concept Set<Set<OWLAxiom>> exp = expGen.getUnsatisfiableExplanations(madCow); out.println("Why is " + madCow + " concept unsatisfiable?"); renderer.render(exp); // Now explain why animal lover is a sub class of pet owner exp = expGen.getSubClassExplanations(animalLover, petOwner); out.println("Why is " + animalLover + " subclass of " + petOwner + "?"); renderer.render(exp); renderer.endRendering(); }
final PelletExplanation explain = new PelletExplanation(reasoner); final Set<Set<OWLAxiom>> actual = explain.getUnsatisfiableExplanations(VolcanicMountain, 0);
@Test public void testPunningSingletonOneOf() { final OWLClass A = OWL.Class("A"); final OWLIndividual a = OWL.Individual("A"); final Set<OWLAxiom> axioms = new HashSet<>(); axioms.add(OWL.equivalentClasses(A, OWL.oneOf(a))); final OWLOntology ontology = OWL.Ontology(axioms); final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); final PelletExplanation explain = new PelletExplanation(reasoner); assertEquals(axioms, explain.getEntailmentExplanation(OWL.classAssertion(a, A))); }
@SuppressWarnings("unused") @Test public void testPunning1() throws Exception { final OWLClass A = OWL.Class("A"); final OWLClass B = OWL.Class("B"); final OWLIndividual i = OWL.Individual("A"); final Set<OWLAxiom> axioms = new HashSet<>(); axioms.add(OWL.disjointClasses(A, B)); axioms.add(OWL.classAssertion(i, A)); axioms.add(OWL.classAssertion(i, B)); final OWLOntology ontology = OWL.Ontology(axioms); final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); final PelletExplanation explain = new PelletExplanation(reasoner); assertFalse(explain.getInconsistencyExplanations().isEmpty()); }
public Set<OWLAxiom> getEntailmentExplanation(final OWLAxiom axiom) { final OWLClassExpression unsatClass = _converter.convert(axiom); return getUnsatisfiableExplanation(unsatClass); }
public void run() throws OWLOntologyCreationException, OWLException, IOException { PelletExplanation.setup(); // The renderer is used to pretty print clashExplanation final ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); // The writer used for the clashExplanation rendered final PrintWriter out = new PrintWriter(System.out); renderer.startRendering(out); // Create an OWLAPI manager that allows to load an ontology file and // create OWLEntities final OWLOntologyManager manager = OWL._manager; final OWLOntology ontology = manager.loadOntology(IRI.create(file)); // Create the reasoner and load the ontology final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); // Create an clashExplanation generator final PelletExplanation expGen = new PelletExplanation(reasoner); // Create some concepts final OWLClass madCow = OWL.Class(NS + "mad+cow"); final OWLClass animalLover = OWL.Class(NS + "animal+lover"); final OWLClass petOwner = OWL.Class(NS + "pet+owner"); // Explain why mad cow is an unsatisfiable concept Set<Set<OWLAxiom>> exp = expGen.getUnsatisfiableExplanations(madCow); out.println("Why is " + madCow + " concept unsatisfiable?"); renderer.render(exp); // Now explain why animal lover is a sub class of pet owner exp = expGen.getSubClassExplanations(animalLover, petOwner); out.println("Why is " + animalLover + " subclass of " + petOwner + "?"); renderer.render(exp); renderer.endRendering(); }
@Test public void testPunningOneOf() { final OWLClass A = OWL.Class("A"); final OWLIndividual a = OWL.Individual("A"); final OWLIndividual b = OWL.Individual("b"); final Set<OWLAxiom> axioms = new HashSet<>(); axioms.add(OWL.equivalentClasses(A, OWL.oneOf(a, b))); final OWLOntology ontology = OWL.Ontology(axioms); final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); final PelletExplanation explain = new PelletExplanation(reasoner); assertEquals(axioms, explain.getEntailmentExplanation(OWL.classAssertion(a, A))); }
@SuppressWarnings("unused") @Test public void testPunning2() throws Exception { final OWLObjectProperty P = OWL.ObjectProperty("P"); final OWLObjectProperty S = OWL.ObjectProperty("S"); final OWLIndividual i = OWL.Individual("P"); final Set<OWLAxiom> axioms = new HashSet<>(); axioms.add(OWL.disjointProperties(P, S)); axioms.add(OWL.propertyAssertion(i, P, i)); axioms.add(OWL.propertyAssertion(i, S, i)); final OWLOntology ontology = OWL.Ontology(axioms); final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); final PelletExplanation explain = new PelletExplanation(reasoner); assertFalse(explain.getInconsistencyExplanations().isEmpty()); }
public Set<OWLAxiom> getEntailmentExplanation(final OWLAxiom axiom) { final OWLClassExpression unsatClass = _converter.convert(axiom); return getUnsatisfiableExplanation(unsatClass); }
public Set<Set<OWLAxiom>> getInconsistencyExplanations(final int maxExplanations) { return getUnsatisfiableExplanations(_factory.getOWLThing(), maxExplanations); }
public Set<OWLAxiom> getInstanceExplanation(final OWLIndividual ind, final OWLClassExpression cls) { final OWLClassAssertionAxiom classAssertion = _factory.getOWLClassAssertionAxiom(cls, ind); return getEntailmentExplanation(classAssertion); }
public Set<Set<OWLAxiom>> getInstanceExplanations(final OWLIndividual ind, final OWLClassExpression cls) { final OWLClassAssertionAxiom classAssertion = _factory.getOWLClassAssertionAxiom(cls, ind); return getEntailmentExplanations(classAssertion); }
@SuppressWarnings("unused") @Test public void testPunning3() throws Exception { final OWLClass A = OWL.Class("A"); final OWLIndividual i = OWL.Individual("A"); final OWLClass B = OWL.Class("B"); final OWLIndividual j = OWL.Individual("B"); final Set<OWLAxiom> axioms = new HashSet<>(); axioms.add(OWL.disjointClasses(A, B)); axioms.add(OWL.classAssertion(i, A)); axioms.add(OWL.classAssertion(j, B)); axioms.add(OWL.sameAs(i, j)); final OWLOntology ontology = OWL.Ontology(axioms); final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); final PelletExplanation explain = new PelletExplanation(reasoner); assertFalse(explain.getInconsistencyExplanations().isEmpty()); }
public Set<OWLAxiom> getEntailmentExplanation(final OWLAxiom axiom) { final OWLClassExpression unsatClass = _converter.convert(axiom); return getUnsatisfiableExplanation(unsatClass); }
public Set<Set<OWLAxiom>> getInconsistencyExplanations(final int maxExplanations) { return getUnsatisfiableExplanations(_factory.getOWLThing(), maxExplanations); }
public Set<OWLAxiom> getInstanceExplanation(final OWLIndividual ind, final OWLClassExpression cls) { final OWLClassAssertionAxiom classAssertion = _factory.getOWLClassAssertionAxiom(cls, ind); return getEntailmentExplanation(classAssertion); }
public Set<Set<OWLAxiom>> getInstanceExplanations(final OWLIndividual ind, final OWLClassExpression cls) { final OWLClassAssertionAxiom classAssertion = _factory.getOWLClassAssertionAxiom(cls, ind); return getEntailmentExplanations(classAssertion); }