@Override
 public boolean hasOntology(OWLOntologyID ontologyId) {
   Set<OWLOntologyID> aliases = ontologyProvider.listAliases(ontologyId);
   if (managedOntologies.contains(ontologyId)) return true;
   for (OWLOntologyID alias : aliases) if (managedOntologies.contains(alias)) return true;
   return false;
 }
  @Override
  public void removeOntology(OWLOntologyID publicKey)
      throws OntologyCollectorModificationException {
    if (publicKey == null)
      throw new IllegalArgumentException(
          "Cannot remove an ontology by providing a null public key.");
    if (publicKey.getOntologyIRI() == null)
      throw new IllegalArgumentException(
          "Cannot remove an ontology whose public key has a null ontology IRI.");
    if (locked) throw new UnmodifiableOntologyCollectorException(this);

    Set<OWLOntologyID> aliases = ontologyProvider.listAliases(publicKey);
    aliases.add(publicKey);
    boolean removed = false;
    for (OWLOntologyID alias : aliases) removed |= managedOntologies.remove(alias);
    // Don't fire if the ontology wasn't there in the first place.
    if (removed) fireOntologyRemoved(publicKey);
    else throw new MissingOntologyException(this, publicKey);
  }