@Test
public void testRenameDataProperty() {
OWLOntology ont = getOWLOntology("testont");
OWLClass clsA = Class(iri("ClsA"));
OWLDataProperty propA = DataProperty(iri("propA"));
OWLDataProperty propA2 = DataProperty(iri("propA2"));
OWLDataPropertyExpression propB = DataProperty(iri("propB"));
OWLIndividual indA = NamedIndividual(iri("indA"));
OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
Set<OWLAxiom> axioms1 = new HashSet<>();
axioms1.add(SubDataPropertyOf(propA, propB));
axioms1.add(EquivalentDataProperties(propA, propB));
axioms1.add(DisjointDataProperties(propA, propB));
axioms1.add(DataPropertyDomain(propA, clsA));
axioms1.add(DataPropertyRange(propA, TopDatatype()));
axioms1.add(FunctionalDataProperty(propA));
axioms1.add(DataPropertyAssertion(propA, indA, Literal(33)));
axioms1.add(NegativeDataPropertyAssertion(propA, indA, Literal(44)));
axioms1.add(AnnotationAssertion(annoProp, propA.getIRI(), Literal("X")));
ont.getOWLOntologyManager().addAxioms(ont, axioms1);
Set<OWLAxiom> axioms2 = new HashSet<>();
axioms2.add(SubDataPropertyOf(propA2, propB));
axioms2.add(EquivalentDataProperties(propA2, propB));
axioms2.add(DisjointDataProperties(propA2, propB));
axioms2.add(DataPropertyDomain(propA2, clsA));
axioms2.add(DataPropertyRange(propA2, TopDatatype()));
axioms2.add(FunctionalDataProperty(propA2));
axioms2.add(DataPropertyAssertion(propA2, indA, Literal(33)));
axioms2.add(NegativeDataPropertyAssertion(propA2, indA, Literal(44)));
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);
}