public void testRenameIndividual() {
OWLOntology ont = getOWLOntology("testont");
OWLClass clsA = Class(iri("ClsA"));
OWLDataProperty propA = DataProperty(iri("propA"));
OWLObjectProperty propB = ObjectProperty(iri("propB"));
OWLNamedIndividual indA = NamedIndividual(iri("indA"));
OWLNamedIndividual indB = NamedIndividual(iri("indA"));
OWLAnnotationProperty annoProp = AnnotationProperty(iri("annoProp"));
Set<OWLAxiom> axioms1 = new HashSet<>();
axioms1.add(ClassAssertion(clsA, indA));
axioms1.add(DataPropertyAssertion(propA, indA, Literal(33)));
axioms1.add(NegativeDataPropertyAssertion(propA, indA, Literal(44)));
axioms1.add(AnnotationAssertion(annoProp, propA.getIRI(), Literal("X")));
axioms1.add(ObjectPropertyAssertion(propB, indA, indB));
axioms1.add(NegativeObjectPropertyAssertion(propB, indA, indB));
ont.getOWLOntologyManager().addAxioms(ont, axioms1);
Set<OWLAxiom> axioms2 = new HashSet<>();
axioms2.add(ClassAssertion(clsA, indB));
axioms2.add(DataPropertyAssertion(propA, indB, Literal(33)));
axioms2.add(NegativeDataPropertyAssertion(propA, indB, Literal(44)));
axioms2.add(AnnotationAssertion(annoProp, propA.getIRI(), Literal("X")));
axioms2.add(ObjectPropertyAssertion(propB, indB, indB));
axioms2.add(NegativeObjectPropertyAssertion(propB, indB, indB));
OWLEntityRenamer entityRenamer = new OWLEntityRenamer(
ont.getOWLOntologyManager(), singleton(ont));
List<OWLOntologyChange> changes = entityRenamer.changeIRI(indA,
indB.getIRI());
ont.getOWLOntologyManager().applyChanges(changes);
assertEquals(ont.getAxioms(), axioms2);
List<OWLOntologyChange> changes2 = entityRenamer.changeIRI(
indB.getIRI(), indA.getIRI());
ont.getOWLOntologyManager().applyChanges(changes2);
assertEquals(ont.getAxioms(), axioms1);
}