@Test public void testOWLAPI() { final OWLClass A = OWL.Class("A"); final OWLClass B = OWL.Class("B"); final OWLClass C = OWL.Class("C"); final OWLIndividual i = OWL.Individual("i"); final OWLIndividual j = OWL.Individual("j"); final Set<OWLAxiom> axioms = new HashSet<>(); axioms.add(OWL.disjointClasses(A, B)); axioms.add(OWL.equivalentClasses(C, OWL.Nothing)); axioms.add(OWL.classAssertion(i, A)); axioms.add(OWL.classAssertion(i, B)); axioms.add(OWL.classAssertion(j, C)); final OWLOntology ontology = OWL.Ontology(axioms); final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); final PelletExplanation explain = new PelletExplanation(reasoner); final Set<Set<OWLAxiom>> actual = explain.getInconsistencyExplanations(); final Set<OWLAxiom> f = new HashSet<>(); f.add(OWL.classAssertion(i, B)); f.add(OWL.classAssertion(i, A)); f.add(OWL.disjointClasses(A, B)); final Set<OWLAxiom> s = new HashSet<>(); s.add(OWL.equivalentClasses(C, OWL.Nothing)); s.add(OWL.classAssertion(j, C)); final Set<Set<OWLAxiom>> expected = new HashSet<>(); expected.add(f); expected.add(s); assertEquals(expected, actual); }
@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()); }
@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()); }
@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()); }