@Test public void testObjecDomainWithEquivalents() { createReasoner(OWL.subClassOf(_A, min(_p, 1)), OWL.domain(_p, _A), OWL.domain(_p, _C), OWL.subClassOf(_A, _B)); assertTrue(_reasoner.isEntailed(OWL.domain(_p, _A))); assertStreamAsSetEquals(Stream.of(_A), _reasoner.getObjectPropertyDomains(_p, true).entities()); assertStreamAsSetEquals(Stream.of(_A, _B, _C, OWL.Thing), _reasoner.getObjectPropertyDomains(_p, false).entities()); }
@Test public void koalaHardWorkingDomain() throws Exception { final String ns = "http://protege.stanford.edu/plugins/owl/owl-library/koala.owl#"; final OWLOntology ontology = _manager.loadOntologyFromOntologyDocument(ClassLoader.getSystemResourceAsStream("test/data/modularity/koala.owl")); final OWLClass animal = OWL.Class(ns + "Animal"); final OWLClass person = OWL.Class(ns + "Person"); final OWLDataProperty hardWorking = OWL.DataProperty(ns + "isHardWorking"); setupGenerators(ontology.axioms()); testExplanations(OWL.domain(hardWorking, animal), 0, new OWLAxiom[] { OWL.subClassOf(person, animal), OWL.domain(hardWorking, person) }); }
@Test public void testObjectDomainWithSubClasses() { createReasoner(OWL.domain(_p, _A), OWL.subClassOf(_A, _B)); assertTrue(_reasoner.isEntailed(OWL.domain(_p, _A))); assertStreamAsSetEquals(Stream.of(_A), _reasoner.getObjectPropertyDomains(_p, true).entities()); assertStreamAsSetEquals(Stream.of(_A, _B, OWL.Thing), _reasoner.getObjectPropertyDomains(_p, false).entities()); }
/** * Test that object property domain axioms are handled correctly */ @Test public void objectDomain() { assertLocal(domain(ObjectProperty("p"), Class("D"))); assertLocal(domain(ObjectProperty("p"), Class("D")), Class("D")); assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p")); assertLocal(domain(ObjectProperty("p"), Thing), ObjectProperty("p")); assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"), Class("D")); }
@Test public void testDataDomainWithSubClasses() { createReasoner(OWL.domain(_dp, _A), OWL.subClassOf(_A, _B)); assertTrue(_reasoner.isEntailed(OWL.domain(_dp, _A))); assertStreamAsSetEquals(Stream.of(_A), _reasoner.getDataPropertyDomains(_dp, true).entities()); assertStreamAsSetEquals(Stream.of(_A, _B, OWL.Thing), _reasoner.getDataPropertyDomains(_dp, false).entities()); }
/** * Test that object property domain axioms are handled correctly */ @Test public void objectDomain() { assertLocal(domain(ObjectProperty("p"), Class("D"))); assertNonLocal(domain(ObjectProperty("p"), Class("D")), Class("D")); assertLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p")); assertLocal(domain(ObjectProperty("p"), Thing), ObjectProperty("p")); assertNonLocal(domain(ObjectProperty("p"), Class("D")), ObjectProperty("p"), Class("D")); } }
@Test public void testDataDomainWithEquivalents() { createReasoner(OWL.subClassOf(_A, min(_dp, 1)), OWL.domain(_dp, _A), OWL.subClassOf(_A, _B)); assertTrue(_reasoner.isEntailed(OWL.domain(_dp, _A))); assertStreamAsSetEquals(Stream.of(_A), _reasoner.getDataPropertyDomains(_dp, true).entities()); assertStreamAsSetEquals(Stream.of(_A, _B, OWL.Thing), _reasoner.getDataPropertyDomains(_dp, false).entities()); }
@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 public void basicTypesTest() { final OWLAxiom[] axioms = { classAssertion(_a, _A), classAssertion(_b, _B), domain(_p, _C), range(_p, _D), propertyAssertion(_a, _p, _b) }; typesTest(axioms); }
@Test public void basicInstancesTest() { final OWLAxiom[] axioms = { classAssertion(_a, _A), classAssertion(_b, _B), domain(_p, _C), range(_p, _D), propertyAssertion(_a, _p, _b) }; instancesTest(axioms); }
@Test public void removeAndAddObjectPropertyDomainAxiom() { createReasoner(declaration(_p), declaration(_C), domain(_p, _C), propertyAssertion(_a, _p, _b)); assertTrue(_reasoner.isConsistent()); assertTrue(_reasoner.isEntailed(classAssertion(_a, _C))); final boolean removeApplied = processRemove(domain(_p, _C)); assertTrue("Unable to remove object property domain axiom", removeApplied); final boolean addApplied = processAdd(domain(_p, _C)); assertTrue("Unable to add object property domain axiom", addApplied); assertTrue(_reasoner.isConsistent()); assertTrue(_reasoner.isEntailed(classAssertion(_a, _C))); } }
@Test public void testObjectRangeWithSubClasses() { createReasoner(OWL.domain(_p, _A), OWL.range(_p, _C), OWL.range(_p, _D), OWL.subClassOf(_C, _E)); assertTrue(_reasoner.isEntailed(OWL.range(_p, _C))); assertStreamAsSetEquals(Stream.of(_C, _D), _reasoner.getObjectPropertyRanges(_p, true).entities()); assertStreamAsSetEquals(Stream.of(_C, _D, _E, OWL.Thing), _reasoner.getObjectPropertyRanges(_p, false).entities()); }
@Test public void basicInstancesUpdateTest() { final OWLAxiom[] axioms = { classAssertion(_a, _A), classAssertion(_b, _B), domain(_p, _C), range(_p, _D), propertyAssertion(_a, _p, _b) }; final OWLAxiom[] additions = { range(_p, _E) }; final OWLAxiom[] deletions = { range(_p, _D) }; instancesUpdateTest(axioms, additions, deletions); }
@Test public void basicTypesUpdateTest() { final OWLAxiom[] axioms = { classAssertion(_a, _A), classAssertion(_b, _B), domain(_p, _C), range(_p, _D), propertyAssertion(_a, _p, _b) }; final OWLAxiom[] additions = { range(_p, _E) }; final OWLAxiom[] deletions = { range(_p, _D) }; typesUpdateTest(axioms, additions, deletions); }
/** * An object property domain axiom should be removable without causing a full KB reload */ @Test public void removeObjectPropertyDomainAxiom() { createReasoner(declaration(_p), declaration(_C), domain(_p, _C), propertyAssertion(_a, _p, _b)); assertTrue(_reasoner.isConsistent()); assertTrue(_reasoner.isEntailed(classAssertion(_a, _C))); final boolean changeApplied = processRemove(domain(_p, _C)); assertTrue("Unable to remove object property domain axiom", changeApplied); assertTrue(_reasoner.isConsistent()); assertFalse(_reasoner.isEntailed(classAssertion(_a, _C))); }
/** * A _data property domain axiom should be removable without causing a full KB reload */ @Test public void removeDataPropertyDomainAxiom() { createReasoner(declaration(_dp), declaration(_C), domain(_dp, _C), propertyAssertion(_a, _dp, _lit)); assertTrue(_reasoner.isConsistent()); assertTrue(_reasoner.isEntailed(classAssertion(_a, _C))); final boolean changeApplied = processRemove(domain(_dp, _C)); assertTrue("Unable to remove _data property domain axiom", changeApplied); assertTrue(_reasoner.isConsistent()); assertFalse(_reasoner.isEntailed(classAssertion(_a, _C))); }
/** * A _data property domain axiom should be removable without causing a full KB reload even if it is a class expression */ @Test public void removeDataPropertyDomainAxiomExpression() { createReasoner(declaration(_dp), declaration(_C), declaration(_D), domain(_dp, or(_C, _D)), propertyAssertion(_a, _dp, _lit)); assertTrue(_reasoner.isConsistent()); assertTrue(_reasoner.isEntailed(classAssertion(_a, or(_C, _D)))); final boolean changeApplied = processRemove(domain(_dp, or(_C, _D))); assertTrue("Unable to remove _data property domain axiom", changeApplied); assertTrue(_reasoner.isConsistent()); assertFalse(_reasoner.isEntailed(classAssertion(_a, or(_C, _D)))); }
@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))); }
/** * An object property domain axiom should be removable without causing a full KB reload even if it is a class expression */ @Test public void removeObjectPropertyDomainAxiomExpression() { createReasoner(declaration(_p), declaration(_C), declaration(_D), domain(_p, or(_C, _D)), propertyAssertion(_a, _p, _b)); assertTrue(_reasoner.isConsistent()); assertTrue(_reasoner.isEntailed(classAssertion(_a, or(_C, _D)))); final boolean changeApplied = processRemove(domain(_p, or(_C, _D))); assertTrue("Unable to remove object property domain axiom", changeApplied); assertTrue(_reasoner.isConsistent()); assertFalse(_reasoner.isEntailed(classAssertion(_a, or(_C, _D)))); }