super(owlOntologyManager);
}
public void render(OWLOntology ontology, Writer writer, OWLOntologyFormat format) throws OWLRendererException {
try {
OWLOntologyNamespaceManager nsm = new OWLOntologyNamespaceManager(getOWLOntologyManager(), ontology);
nsm.setDefaultNamespace(Namespaces.OWL2XML.toString());
nsm.setPrefix("owl2xml", Namespaces.OWL2XML.toString());
if(format instanceof NamespaceOWLOntologyFormat) {
NamespaceOWLOntologyFormat namespaceFormat = (NamespaceOWLOntologyFormat) format;
final Map<String,String> nsByPrefixMap = namespaceFormat.getNamespacesByPrefixMap();
for(String prefix : nsByPrefixMap.keySet()) {
String ns = nsByPrefixMap.get(prefix);
if(ns != null && ns.length() > 0) {
nsm.setPrefix(prefix, ns);
}
}
if(namespaceFormat.getDefaultNamespace() != null) {
nsm.setDefaultNamespace(namespaceFormat.getDefaultNamespace());
}
}
OWLXMLWriter w = new OWLXMLWriter(writer, nsm, ontology);
w.startDocument(ontology);
OWLXMLObjectRenderer ren = new OWLXMLObjectRenderer(ontology, w);