private XMLWriter writer;
private Map<String, String> iriPrefixMap = new TreeMap<String, String>(new StringLengthComparator());
public OWLXMLWriter(Writer writer, OWLOntology ontology) {
XMLWriterNamespaceManager nsm = new XMLWriterNamespaceManager(Namespaces.OWL.toString());
nsm.setPrefix("xsd", Namespaces.XSD.toString());
nsm.setPrefix("rdf", Namespaces.RDF.toString());
nsm.setPrefix("rdfs", Namespaces.RDFS.toString());
nsm.setPrefix("xml", Namespaces.XML.toString());
String base = Namespaces.OWL.toString();
if (ontology != null && !ontology.isAnonymous()) {
base = ontology.getOntologyID().getOntologyIRI().toString();
}
this.writer = XMLWriterFactory.getInstance().createXMLWriter(writer, nsm, base);