Class OWLXMLWriter

java.lang.Object
org.semanticweb.owlapi.owlxml.renderer.OWLXMLWriter

public class OWLXMLWriter extends Object
Writes OWL/XML. In an OWL/XML documents written by this writer, the base is always the ontology URI, and the default namespace is always the OWL namespace (http://www.w3.org/2002/07/owl#). Unlike RDF/XML, entity URIs aren't abbreviated using the XML namespace mechanism, instead they are encoded using 'prefix' elements.
Since:
2.0.0
Author:
Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
  • Constructor Details

    • OWLXMLWriter

      public OWLXMLWriter(PrintWriter writer, OWLOntology ontology)
      Parameters:
      writer - writer
      ontology - ontology
  • Method Details

    • getIRIPrefixMap

      public Map<String,String> getIRIPrefixMap()
      Returns:
      iri to prefix map
    • getNamespaceManager

      public XMLWriterNamespaceManager getNamespaceManager()
      Returns:
      namespace manager
    • writePrefix

      public void writePrefix(String prefixName, String iri)
      A convenience method to write a prefix.
      Parameters:
      prefixName - The name of the prefix (e.g. owl: is the prefix name for the OWL prefix)
      iri - The prefix iri
    • getIRIString

      public String getIRIString(IRI iri)
      Gets an IRI attribute value for a full IRI. If the IRI has a prefix that coincides with a written prefix then the compact IRI will be returned, otherwise the full IRI will be returned.
      Parameters:
      iri - The IRI
      Returns:
      Either the compact version of the IRI or the full IRI.
    • startDocument

      public void startDocument(OWLOntology ontology) throws OWLRendererException
      Parameters:
      ontology - ontology
      Throws:
      OWLRendererException - renderer error
    • endDocument

      public void endDocument()
      End document.
    • writeStartElement

      public void writeStartElement(OWLXMLVocabulary name)
      Parameters:
      name - name
    • writeEndElement

      public void writeEndElement()
      Write end element.
    • writeDatatypeAttribute

      public void writeDatatypeAttribute(OWLDatatype datatype)
      Writes a datatype attributed (used on Literal elements). The full datatype IRI is written out.
      Parameters:
      datatype - The datatype
    • writeNodeIDAttribute

      public void writeNodeIDAttribute(NodeID nodeID)
      Parameters:
      nodeID - nodeID
    • writeIRIAttribute

      public void writeIRIAttribute(IRI iri)
      Parameters:
      iri - iri
    • writeIRIElement

      public void writeIRIElement(IRI iri)
      Writes an IRI element for a given IRI.
      Parameters:
      iri - The IRI to be written as an element. If the IRI can be abbreviated then an AbbreviatedIRI element will be written
    • writeLangAttribute

      public void writeLangAttribute(String lang)
      Parameters:
      lang - language tag
    • writeCardinalityAttribute

      public void writeCardinalityAttribute(int cardinality)
      Parameters:
      cardinality - cardinality
    • writeTextContent

      public void writeTextContent(String text)
      Parameters:
      text - text
    • writeFacetAttribute

      public void writeFacetAttribute(OWLFacet facet)
      Parameters:
      facet - facet
    • writeAnnotationURIAttribute

      public void writeAnnotationURIAttribute(URI uri)
      Parameters:
      uri - URI