@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 testAddAndRemove() throws OWLOntologyCreationException { try (final OWLManagerGroup group = new OWLManagerGroup()) { final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.add.remove"), 1.0); final OWLHelper owl = new OWLGenericTools(group, ontId, true); owl.addAxiom(OWL.declaration(OWL.DataProperty(NS + "propA"))); owl.addAxiom(OWL.declaration(OWL.Class(NS + "clsA"))); owl.addAxiom(OWL.equivalentClasses(OWL.Class(NS + "clsA"), // OWL.value(OWL.DataProperty(NS + "propA"), OWL.constant(12))// )); assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0); final OWLNamedIndividual x1 = OWL.Individual(NS + "I1"); owl.addAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA"))); assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 1); owl.removeAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA"))); assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0); } // The test is just about not crash. }
@Test public void testAddAndRemove() throws OWLOntologyCreationException { try (final OWLManagerGroup group = new OWLManagerGroup()) { final OWLOntologyID ontId = OWLHelper.getVersion(IRI.create(NS + "owlapi.add.remove"), 1.0); final OWLHelper owl = new OWLGenericTools(group, ontId, true); owl.addAxiom(OWL.declaration(OWL.DataProperty(NS + "propA"))); owl.addAxiom(OWL.declaration(OWL.Class(NS + "clsA"))); owl.addAxiom(OWL.equivalentClasses(OWL.Class(NS + "clsA"), // OWL.value(OWL.DataProperty(NS + "propA"), OWL.constant(12))// )); assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0); final OWLNamedIndividual x1 = OWL.Individual(NS + "I1"); owl.addAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA"))); assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 1); owl.removeAxiom(OWL.classAssertion(x1, OWL.Class(NS + "clsA"))); assertTrue(owl.getReasoner().instances(OWL.Class(NS + "clsA")).count() == 0); } // The test is just about not crash. }