title: How to get IRI of an Ontology in OWL
body: <p>In previous versions of OWL-API, obtaining iri from ontology was done through</p>
  
  <pre><code>ontology.getOntologyID().getOntologyIRI();
  </code></pre>
  
  <p>But now getOntologyIRI() returns Optional and therefore the above code does not work. Is there any method to retrieve Ontology's IRI?</p>
  
  <p><a href="https://i.stack.imgur.com/LWtXJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LWtXJ.png" alt="Error image"></a></p>