@Test
public void testRenameObjectProperty() {
OWLOntology ont = getOWLOntology("testont");
OWLClass clsA = Class(iri("ClsA"));
OWLObjectProperty propA = ObjectProperty(iri("propA"));
OWLObjectProperty propA2 = ObjectProperty(iri("propA2"));
OWLObjectPropertyExpression propB = ObjectProperty(iri("propB"))
.getInverseProperty();
OWLIndividual indA = NamedIndividual(iri("indA"));
OWLIndividual indB = NamedIndividual(iri("indB"));
OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
Set<OWLAxiom> axioms1 = new HashSet<>();
axioms1.add(SubObjectPropertyOf(propA, propB));
axioms1.add(EquivalentObjectProperties(propA, propB));
axioms1.add(DisjointObjectProperties(propA, propB));
axioms1.add(ObjectPropertyDomain(propA, clsA));
axioms1.add(ObjectPropertyRange(propA, clsA));
axioms1.add(FunctionalObjectProperty(propA));
axioms1.add(InverseFunctionalObjectProperty(propA));
axioms1.add(SymmetricObjectProperty(propA));
axioms1.add(AsymmetricObjectProperty(propA));
axioms1.add(TransitiveObjectProperty(propA));
axioms1.add(ReflexiveObjectProperty(propA));
axioms1.add(IrreflexiveObjectProperty(propA));
axioms1.add(ObjectPropertyAssertion(propA, indA, indB));
axioms1.add(NegativeObjectPropertyAssertion(propA, indA, indB));
axioms1.add(AnnotationAssertion(annoProp, propA.getIRI(), Literal("X")));
ont.getOWLOntologyManager().addAxioms(ont, axioms1);
Set<OWLAxiom> axioms2 = new HashSet<>();
axioms2.add(SubObjectPropertyOf(propA2, propB));
axioms2.add(EquivalentObjectProperties(propA2, propB));
axioms2.add(DisjointObjectProperties(propA2, propB));
axioms2.add(ObjectPropertyDomain(propA2, clsA));
axioms2.add(ObjectPropertyRange(propA2, clsA));
axioms2.add(FunctionalObjectProperty(propA2));
axioms2.add(InverseFunctionalObjectProperty(propA2));
axioms2.add(SymmetricObjectProperty(propA2));
axioms2.add(AsymmetricObjectProperty(propA2));
axioms2.add(TransitiveObjectProperty(propA2));
axioms2.add(ReflexiveObjectProperty(propA2));
axioms2.add(IrreflexiveObjectProperty(propA2));
axioms2.add(ObjectPropertyAssertion(propA2, indA, indB));
axioms2.add(NegativeObjectPropertyAssertion(propA2, indA, indB));
axioms2.add(AnnotationAssertion(annoProp, propA2.getIRI(), Literal("X")));
OWLEntityRenamer entityRenamer = new OWLEntityRenamer(
ont.getOWLOntologyManager(), singleton(ont));
List<OWLOntologyChange> changes = entityRenamer.changeIRI(propA,
propA2.getIRI());
ont.getOWLOntologyManager().applyChanges(changes);
assertEquals(ont.getAxioms(), axioms2);
List<OWLOntologyChange> changes2 = entityRenamer.changeIRI(
propA2.getIRI(), propA.getIRI());
ont.getOWLOntologyManager().applyChanges(changes2);
assertEquals(ont.getAxioms(), axioms1);
}