robot-core/src/main/java/org/obolibrary/robot/RenameOperation.java
public static void renamePrefixes(
      OWLOntology ontology, IOHelper ioHelper, Map<String, String> mappings) {
    OWLOntologyManager manager = ontology.getOWLOntologyManager();
    OWLEntityRenamer entityRenamer = new OWLEntityRenamer(manager, Sets.newHashSet(ontology));
    Set<IRI> allIRIs = OntologyHelper.getIRIs(ontology);
    for (Map.Entry<String, String> mapping : mappings.entrySet()) {
      String oldBase = mapping.getKey();
      String newBase = mapping.getValue();
      Set<IRI> matchIRIs =
          allIRIs
              .stream()
              .filter(iri -> iri.toString().startsWith(oldBase))
              .collect(Collectors.toSet());
      if (matchIRIs.isEmpty()) {
        logger.warn(String.format("No entities with prefix '%s' to rename", oldBase));
        continue;
      }
      for (IRI iri : matchIRIs) {
        IRI newIRI = ioHelper.createIRI(iri.toString().replace(oldBase, newBase));
        manager.applyChanges(entityRenamer.changeIRI(iri, newIRI));
      }
    }
  }
/**
   * Given an ontology, an IOHelper, and a map of old IRI bases to new IRI bases, rename each IRI
   * with the 'old base' as a prefix, replacing it with the 'new base'.
   *
   * @param ontology OWLOntology to rename base prefixes in
   * @param ioHelper IOHelper to create IRIs
   * @param mappings map of old base to new base
   */
Given an ontology, an IOHelper, and a map of old IRI bases to new IRI bases, rename each IRI
with the 'old base' as a prefix, replacing it with the 'new base'.

@param ontology OWLOntology to rename base prefixes in
@param ioHelper IOHelper to create IRIs
@param mappings map of old base to new base
Given an ontology an IOHelper and a map of old IRI bases to new IRI bases rename each IRI with the ' old base ' as a prefix replacing it with the ' new base ' . @param ontology OWLOntology to rename base prefixes in @param ioHelper IOHelper to create IRIs @param mappings map of old base to new base
public static void renamePrefixes(
      OWLOntology ontology, IOHelper ioHelper, Map<String, String> mappings) {
    OWLOntologyManager manager = ontology.getOWLOntologyManager();
    OWLEntityRenamer entityRenamer = new OWLEntityRenamer(manager, Sets.newHashSet(ontology));
    Set<IRI> allIRIs = OntologyHelper.getIRIs(ontology);
    for (Map.Entry<String, String> mapping : mappings.entrySet()) {
      String oldBase = mapping.getKey();
      String newBase = mapping.getValue();
      Set<IRI> matchIRIs =
          allIRIs
              .stream()
              .filter(iri -> iri.toString().startsWith(oldBase))
              .collect(Collectors.toSet());
      if (matchIRIs.isEmpty()) {
        logger.warn(String.format("No entities with prefix '%s' to rename", oldBase));
        continue;
      }
      for (IRI iri : matchIRIs) {
        IRI newIRI = ioHelper.createIRI(iri.toString().replace(oldBase, newBase));
        manager.applyChanges(entityRenamer.changeIRI(iri, newIRI));
      }
    }
  }
public static void renamePrefixes ( OWLOntology ontology , IOHelper ioHelper , Map < String , String > mappings ) { OWLOntologyManager manager = ontology . getOWLOntologyManager ( ) ; OWLEntityRenamer entityRenamer = new OWLEntityRenamer ( manager , Sets . newHashSet ( ontology ) ) ; Set < IRI > allIRIs = OntologyHelper . getIRIs ( ontology ) ; for ( Map . Entry < String , String > mapping : mappings . entrySet ( ) ) { String oldBase = mapping . getKey ( ) ; String newBase = mapping . getValue ( ) ; Set < IRI > matchIRIs = allIRIs . stream ( ) . filter ( iri -> iri . toString ( ) . startsWith ( oldBase ) ) . collect ( Collectors . toSet ( ) ) ; if ( matchIRIs . isEmpty ( ) ) { logger . warn ( String . format ( "No entities with prefix '%s' to rename" , oldBase ) ) ; continue ; } for ( IRI iri : matchIRIs ) { IRI newIRI = ioHelper . createIRI ( iri . toString ( ) . replace ( oldBase , newBase ) ) ; manager . applyChanges ( entityRenamer . changeIRI ( iri , newIRI ) ) ; } } }
Given an ontology, an IOHelper, and a map of old IRI bases to new IRI bases, rename each IRI
 with the 'old base' as a prefix, replacing it with the 'new base'.
Given an ontology an IOHelper and a map of old IRI bases to new IRI bases rename each IRI with the ' old base ' as a prefix replacing it with the ' new base ' .