public void writeOntologyHeader(OWLOntology ontology) { event = new RendererEvent(this, ontology); fireFrameRenderingPrepared(ONTOLOGY.toString()); write(ONTOLOGY.toString()); write(":"); writeSpace(); if (!ontology.isAnonymous()) { int indent = getIndent(); writeFullURI(ontology.getOntologyID().getOntologyIRI().toString()); writeNewLine(); pushTab(indent); if (ontology.getOntologyID().getVersionIRI() != null) { writeFullURI(ontology.getOntologyID().getVersionIRI().toString()); } popTab(); } fireFrameRenderingStarted(ONTOLOGY.toString()); writeNewLine(); for (OWLImportsDeclaration decl : ontology.getImportsDeclarations()) { fireSectionItemPrepared(IMPORT.toString()); write(IMPORT.toString()); write(":"); writeSpace(); fireSectionRenderingStarted(IMPORT.toString()); writeFullURI(decl.getURI().toString()); writeNewLine(); fireSectionRenderingFinished(IMPORT.toString()); } writeNewLine(); writeSection(ANNOTATIONS, ontology.getAnnotations(), ",", true); fireFrameRenderingFinished(ONTOLOGY.toString()); }
public TurtleRenderer( OWLOntology ontology, OWLOntologyManager manager, Writer writer, OWLOntologyFormat format) { super(ontology, manager, format); this.writer = new PrintWriter(writer); pending = new HashSet<RDFResourceNode>(); pm = new DefaultPrefixManager(); if (!ontology.isAnonymous()) { pm.setDefaultPrefix(ontology.getOntologyID().getOntologyIRI() + "#"); } if (format instanceof PrefixOWLOntologyFormat) { PrefixOWLOntologyFormat prefixFormat = (PrefixOWLOntologyFormat) format; for (String prefixName : prefixFormat.getPrefixNames()) { pm.setPrefix(prefixName, prefixFormat.getPrefix(prefixName)); } } base = ""; }