@Test public void basicDisjointnessUpdateTest() { final OWLAxiom[] axioms = { disjointClasses(_A, _B), subClassOf(_C, _A), subClassOf(_D, _B), equivalentClasses(_E, _A) }; final OWLAxiom[] additions = { disjointClasses(_D, _C) }; final OWLAxiom[] deletions = { disjointClasses(_A, _B) }; disjointnessUpdateTest(axioms, additions, deletions); }
@Test public void expressionInRange() throws Exception { final OWLAxiom[] axioms = { OWL.subClassOf(_A, OWL.some(_p, _B)), OWL.range(_p, OWL.or(_C, _D)), OWL.disjointClasses(_B, _C), OWL.disjointClasses(_B, _D) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.subClassOf(_A, OWL.Nothing), 0, axioms); }
@Test public void disjointRange() throws Exception { final OWLAxiom[] axioms = { OWL.subClassOf(_A, OWL.some(_p, _B)), OWL.range(_p, _C), OWL.disjointClasses(_B, _C) }; final OWLAxiom axiom = OWL.equivalentClasses(_A, OWL.Nothing); final OWLAxiom[] explanation = new OWLAxiom[] { OWL.subClassOf(_A, OWL.some(_p, _B)), OWL.range(_p, _C), OWL.disjointClasses(_B, _C) }; setupGenerators(Stream.of(axioms)); testExplanations(axiom, 0, explanation); }
@Test public void disjointSupers() throws Exception { final OWLAxiom[] axioms = { OWL.subClassOf(_A, _B), OWL.subClassOf(_A, _C), OWL.disjointClasses(_B, _C) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.equivalentClasses(_A, OWL.Nothing), 0, axioms); }
@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); }
@Test public void disjointRangeSuper() throws Exception { final OWLAxiom[] axioms = { OWL.subClassOf(_A, OWL.some(_p, _B)), OWL.range(_p, _C), OWL.subClassOf(_B, _D), OWL.disjointClasses(_D, _C), OWL.subClassOf(_A, _E), OWL.subClassOf(_B, _F) }; setupGenerators(Stream.of(axioms)); // explain disjointness of _B and _C first so reasoner will _cache this // result testExplanations(OWL.disjointClasses(_B, _C), 0, new OWLAxiom[] { axioms[2], axioms[3] }); // explain the unsatisfiability of _A and make sure cached results do not // interfere with clashExplanation testExplanations(OWL.equivalentClasses(_A, OWL.Nothing), 0, new OWLAxiom[] { axioms[0], axioms[1], axioms[2], axioms[3] }); }
@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()); }
@Test public void unsatisfiableTest1() { final OWLAxiom[] axioms = { subClassOf(_A, _B), subClassOf(_A, _C), subClassOf(_D, Thing) }; final OWLAxiom[] additions = { disjointClasses(_B, _C) }; final OWLAxiom[] deletions = {}; updateTest(axioms, additions, deletions); }
@Test public void basicDisjointnessTest() { final OWLAxiom[] axioms = { disjointClasses(_A, _B), subClassOf(_C, _A), subClassOf(_D, _B), equivalentClasses(_E, _A) }; disjointnessTest(axioms); }
@Test public void testDisjointClasses() { _pattern.setMaxAllowed(2); final OWLClassExpression union = OWL.or(_cls[1], _cls[2], _cls[3]); final OWLAxiom axiom = OWL.disjointClasses(_cls[0], union); assertNotNull(_pattern.match(_ontology, axiom)); }
/** * Test that changes to make an unsatisfiable class satisfiable cause it to be reparented in the taxonomy. (Failed in r94 and earlier). * * @throws OWLException */ @Test public void makeSatisfiable() { final OWLAxiom[] axioms = { subClassOf(_A, _B), subClassOf(_A, _C), disjointClasses(_B, _C) }; final OWLAxiom[] additions = {}; final OWLAxiom[] deletions = { subClassOf(_A, _B) }; updateTest(axioms, additions, deletions); }
@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()); }
@Test public void expressionInDomain() throws Exception { final OWLAxiom[] axioms = { OWL.subClassOf(_A, OWL.some(_p, _B)), OWL.domain(_p, OWL.or(_C, _D)), OWL.disjointClasses(_A, _C) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.subClassOf(_A, _D), 0, axioms); }
/** * Test for #447 */ @Test public void testGetUnsatClasses() { createReasoner(OWL.disjointClasses(_A, _B), OWL.equivalentClasses(_C, OWL.and(_A, _B))); assertStreamAsSetEquals(Stream.of(_C, OWL.Nothing), _reasoner.getUnsatisfiableClasses().entities()); assertStreamAsSetEquals(Stream.of(_C, OWL.Nothing), _reasoner.getEquivalentClasses(_C).entities()); }
/** * Test that changes to remove an unsatisfiable cause it to be removed. (Failed in r94 and earlier). * * @throws OWLException */ @Test public void deleteUnsatisfiable() { final OWLAxiom[] axioms = { subClassOf(_A, _B), subClassOf(_A, _C), disjointClasses(_B, _C) }; final OWLAxiom[] additions = {}; final OWLAxiom[] deletions = { subClassOf(_A, _B), subClassOf(_A, _C) }; updateTest(axioms, additions, deletions); }
OWL.disjointClasses(UplandArea, Volcano) // };
@Test public void testOneMax() { _pattern.setMaxAllowed(2); final OWLClassExpression maxCard = OWL.max(_pro[0], 3); final OWLAxiom axiom = OWL.disjointClasses(_cls[0], maxCard); final Lint lint = _pattern.match(_ontology, axiom); assertNotNull(lint); assertSame(_pattern, lint.getPattern()); assertEquals(1, lint.getParticipatingAxioms().size()); assertNull(lint.getLintFixer()); assertEquals(3.0, lint.getSeverity().doubleValue(), DOUBLE_DELTA); assertSame(_ontology, lint.getParticipatingOntology()); }
@Test public void testNone() { assertTrue(_pattern.isFixable()); OWLAxiom axiom = OWL.subClassOf(_cls[0], _P0AllC0); assertNull(_pattern.match(_ontology, axiom)); axiom = OWL.disjointClasses(_cls[1], _P0AllC0); assertNull(_pattern.match(_ontology, axiom)); axiom = OWL.equivalentClasses(CollectionUtil.asSet(_cls[0], _P0AllC0, _cls[2])); assertNull(_pattern.match(_ontology, axiom)); }
@Test /** * Tests for the bug reported in #150 */ public void test150_2() { createReasoner(OWL.domain(_p, _C), OWL.range(_q, _D), OWL.disjointClasses(_C, _D)); assertTrue(_reasoner.isEntailed(OWL.disjointProperties(_p, OWL.inverse(_q)))); assertTrue(_reasoner.isEntailed(OWL.disjointProperties(OWL.inverse(_p), _q))); }
@Test public void testInvalidTransitivity() { final String ns = "http://www.example.org/test#"; final OWLClass C = Class(ns + "C"); final OWLObjectProperty p1 = ObjectProperty(ns + "p1"); final OWLObjectProperty p2 = ObjectProperty(ns + "p2"); final OWLIndividual x = Individual(ns + "x"); final OWLIndividual y = Individual(ns + "y"); final OWLIndividual z = Individual(ns + "z"); final OWLOntology ont = OWL.Ontology(transitive(p1), classAssertion(x, all(p1, C)), propertyAssertion(x, p1, y), propertyAssertion(y, p1, z)); OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont); assertTrue(reasoner.isEntailed(classAssertion(y, C))); assertTrue(reasoner.isEntailed(classAssertion(z, C))); final OWLAxiom[] axioms = new OWLAxiom[] { functional(p1), inverseFunctional(p1), irreflexive(p1), asymmetric(p1), disjointProperties(p1, p2), subClassOf(C, min(p1, 2)), classAssertion(x, max(p1, 3)), disjointClasses(C, min(p1, 2)) }; for (final OWLAxiom axiom : axioms) { ont.add(axiom); reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont); assertTrue(axiom.toString(), reasoner.isEntailed(classAssertion(y, C))); assertFalse(axiom.toString(), reasoner.isEntailed(classAssertion(z, C))); ont.remove(axiom); } }