OWLOntologyFormat format = null;
if (RDF_XML_TYPE.equals(mediaType)) format = new RDFXMLOntologyFormat();
else if (OWL_XML_TYPE.equals(mediaType)) format = new OWLXMLOntologyFormat();
else if (MANCHESTER_OWL_TYPE.equals(mediaType)) format = new ManchesterOWLSyntaxOntologyFormat();
else if (FUNCTIONAL_OWL_TYPE.equals(mediaType)) format = new OWLFunctionalSyntaxOntologyFormat();
else if (TURTLE_TYPE.equals(mediaType) || X_TURTLE_TYPE.equals(mediaType)) format = new TurtleOntologyFormat();
if (format != null) try {
manager.saveOntology(ontology, format, out);
} catch (OWLOntologyStorageException e) {
log.error("Failed to store ontology for rendering.", e);