@Test public void propertyChain1() throws Exception { final OWLAxiom[] axioms = { OWL.subPropertyOf(new OWLObjectProperty[] { _p, _q }, _r), OWL.propertyAssertion(_a, _p, _b), OWL.propertyAssertion(_b, _q, _c) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, _p, _b), 0, new OWLAxiom[] { axioms[1] }); testExplanations(OWL.propertyAssertion(_a, _r, _c), 0, axioms); }
@Test public void simplePropertyAssertion() throws Exception { // this test case is to check the effect of hasObviousPropertyValue final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, _p, _b) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, _p, _b), 0, axioms); }
@Test public void testTopBottomPropertyAssertion() { final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, OWL.topObjectProperty, _b), OWL.propertyAssertion(_a, OWL.topDataProperty, _lit), OWL.propertyAssertion(_a, OWL.bottomObjectProperty, _b), OWL.propertyAssertion(_a, OWL.bottomDataProperty, _lit) }; for (int i = 0; i < axioms.length; i++) { final OWLOntology ont = OWL.Ontology(axioms[i]); final OpenlletReasoner pellet = OpenlletReasonerFactory.getInstance().createReasoner(ont); assertEquals(i < 2, pellet.isConsistent()); } }
@Test public void subPropertyAssertion() throws Exception { // this test case is to check the effect of hasObviousPropertyValue final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, _p, _b), OWL.subPropertyOf(_p, _q) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, _q, _b), 0, axioms); }
@Test public void inferredSubProperty() throws Exception { final OWLAxiom[] axioms = { OWL.subPropertyOf(_p, _r), OWL.subPropertyOf(_r, _q), OWL.propertyAssertion(_a, _p, _b) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, _r, _b), 0, new OWLAxiom[] { axioms[0], axioms[2] }); testExplanations(OWL.propertyAssertion(_a, _q, _b), 0, axioms); }
@Test public void differentFromAndFunctionality() throws Exception { assumeTrue(!_classify); final OWLAxiom[] axioms = { OWL.functional(_p), OWL.propertyAssertion(_a, _p, _b), OWL.propertyAssertion(_a, _p, _c), OWL.propertyAssertion(_a, _p, _d), OWL.differentFrom(_b, _c), OWL.differentFrom(_c, _d) }; setupGenerators(Stream.of(axioms)); testInconsistencyExplanations(0, new OWLAxiom[] { axioms[0], axioms[1], axioms[2], axioms[4] }, new OWLAxiom[] { axioms[0], axioms[2], axioms[3], axioms[5] }); } }
@Test public void subPropertiesOfFunctionalDataProperty() throws Exception { final OWLAxiom[] axioms = { OWL.functional(dp), OWL.subPropertyOf(dq, dp), OWL.subPropertyOf(dr, dp), OWL.propertyAssertion(_a, dq, OWL.constant(1)), OWL.classAssertion(_a, OWL.some(dr, XSD.INTEGER)) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, dp, OWL.constant(1)), 0, new OWLAxiom[] { axioms[1], axioms[3] }); testExplanations(OWL.propertyAssertion(_a, dr, OWL.constant(1)), 0, axioms); }
@Test public void transitiveProperty() throws Exception { final OWLAxiom[] axioms = { OWL.transitive(_p), OWL.propertyAssertion(_a, _p, _b), OWL.propertyAssertion(_b, _p, _c), OWL.equivalentClasses(_A, OWL.value(_p, _c)) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_b, _A), 0, new OWLAxiom[] { axioms[2], axioms[3] }); testExplanations(OWL.classAssertion(_a, _A), 0, axioms); }
@Test public void datatypeEnumeration() throws Exception { final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, dp, OWL.constant(1)), OWL.propertyAssertion(_a, dp, OWL.constant(2)), OWL.equivalentClasses(_A, OWL.some(dp, _dt)), OWL.datatypeDefinition(_dt, OWL.oneOf(OWL.constant(1), OWL.constant(2), OWL.constant(3))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _A), 0, new OWLAxiom[] { axioms[0], axioms[2], axioms[3] }, new OWLAxiom[] { axioms[1], axioms[2], axioms[3] }); }
/** * Test that anonymous individuals as the object of property assertions are translated correctly */ @Test public void anonymousIndividualPropertyAssertion() throws Exception { assumeTrue(!(this instanceof JenaExplanationTest)); final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, _p, _anon1), OWL.classAssertion(_anon1, _A), OWL.subClassOf(OWL.some(_p, _A), _B) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _B), 0, 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 multipleDatatypeRange() throws Exception { final OWLAxiom[] axioms = { OWL.range(dp, XSD.BYTE), OWL.range(dp, XSD.NON_POSITIVE_INTEGER), OWL.range(dp, XSD.NON_NEGATIVE_INTEGER), OWL.subClassOf(_A, OWL.min(dp, 1)), OWL.classAssertion(_a, _A) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, dp, OWL.constant(0)), 0, new OWLAxiom[] { axioms[1], axioms[2], axioms[3], axioms[4] }); }
@Test public void userDefinedDatatype1() throws Exception { final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), OWL.equivalentClasses(_B, OWL.and(_A, OWL.some(dp, OWL.restrict(XSD.INTEGER, OWL.maxExclusive(10))))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _B), 0, axioms); }
@Test public void ruleTest6() throws Exception { final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, _p, _b), OWL.classAssertion(_b, _B), SWRL.rule(SWRL.antecedent(SWRL.classAtom(OWL.some(_p, _B), _x)), SWRL.consequent(SWRL.classAtom(_C, _x))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _C), 1, axioms); }
@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); }
@Test public void ruleTest2() throws Exception { final OWLAxiom[] axioms = { OWL.subPropertyOf(_q, _p), OWL.propertyAssertion(_a, _q, _b), OWL.classAssertion(_b, _B), SWRL.rule(SWRL.antecedent(SWRL.propertyAtom(_p, _x, _y), SWRL.classAtom(_B, _y)), SWRL.consequent(SWRL.classAtom(_A, _x))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _A), 1, axioms); }
@Test public void ruleTest5() throws Exception { final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, _p, _b), SWRL.rule(SWRL.antecedent(SWRL.propertyAtom(_p, _x, _y)), SWRL.consequent(SWRL.classAtom(_A, _x), SWRL.classAtom(_B, _y))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _A), 1, axioms); testExplanations(OWL.classAssertion(_b, _B), 1, axioms); }
@Test public void ruleBuiltinTest1() throws Exception { final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), SWRL.rule(SWRL.antecedent(SWRL.classAtom(_A, _x), SWRL.propertyAtom(dp, _x, _dx), SWRL.lessThan(_dx, SWRL.constant(10))), SWRL.consequent(SWRL.classAtom(_B, _x))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _B), 0, axioms); }
public void testLuigiFamilyOWLApi() throws Exception { final OWLOntologyManager manager = OWL._manager; final OWLOntology familyRef = manager.loadOntology(IRI.create(_base + "basicFamilyReference.owl")); final OWLOntology familyRules = manager.loadOntology(IRI.create(_base + "basicFamilyRules.owl")); final OWLOntology mergedOntology = OWL.Ontology(Stream.concat(familyRef.axioms(), familyRules.axioms())); final OpenlletReasoner reasoner = openllet.owlapi.OpenlletReasonerFactory.getInstance().createReasoner(mergedOntology); final OWLIndividual nella = OWL.Individual(_luigiFamily.resolve("#Nella")); final OWLObjectProperty hasUncle = OWL.ObjectProperty(_luigiFamily.resolve("#hasUncle")); final OWLIndividual dino = OWL.Individual(_luigiFamily.resolve("#Dino")); assertFalse(reasoner.isEntailed(OWL.propertyAssertion(nella, hasUncle, dino))); }
@Test public void ruleTest1b() throws Exception { final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.classAssertion(_b, _B), OWL.propertyAssertion(_a, _p, _b), SWRL.rule(SWRL.antecedent(SWRL.classAtom(_A, _x)), SWRL.consequent(SWRL.classAtom(_B, _x))), SWRL.rule(SWRL.antecedent(SWRL.classAtom(_B, _x), SWRL.propertyAtom(_p, _x, _y), SWRL.classAtom(_B, _y)), SWRL.consequent(SWRL.classAtom(_C, _x))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _A), 0, new OWLAxiom[] { axioms[0] }); testExplanations(OWL.classAssertion(_a, _B), 0, new OWLAxiom[] { axioms[0], axioms[3] }); testExplanations(OWL.classAssertion(_a, _C), 1, axioms); }