Class ZipIRIMapper

java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.semanticweb.owlapi.util.ZipIRIMapper
All Implemented Interfaces:
Serializable, OWLOntologyIRIMapper, ContentHandler, DTDHandler, EntityResolver, ErrorHandler

@HasPriority(1.0) public class ZipIRIMapper extends DefaultHandler implements OWLOntologyIRIMapper, Serializable
A mapper which given a root folder attempts to automatically discover and map files to ontologies. The mapper is only capable of mapping ontologies in RDF/XML and OWL/XML (other serialisations are not supported).
Since:
2.0.0
Author:
Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
See Also:
  • Constructor Details

    • ZipIRIMapper

      public ZipIRIMapper(File zip, String baseIRI) throws IOException
      Creates an auto-mapper which examines ontologies that reside in the specified zip file.
      Parameters:
      zip - The zip file to map.
      baseIRI - base iri for physical IRIs
      Throws:
      IOException - if an exception reading from input is raised
    • ZipIRIMapper

      public ZipIRIMapper(ZipFile zip, String baseIRI) throws IOException
      Creates an auto-mapper which examines ontologies that reside in the specified zip file.
      Parameters:
      zip - The zip file to map.
      baseIRI - base iri for physical IRIs
      Throws:
      IOException - if an exception reading from input is raised
  • Method Details

    • getFileExtensions

      public Set<String> getFileExtensions()
      The mapper only examines files that have specified file extensions. This method returns the file extensions that cause a file to be examined.
      Returns:
      A Set of file extensions.
    • setFileExtensions

      public void setFileExtensions(Collection<String> extensions)
      Sets the extensions of files that are to be examined for ontological content. (By default the extensions are, owl, xml and rdf). Only files that have the specified extensions will be examined to see if they contain ontologies.
      Parameters:
      extensions - the set of extensions
    • mappedEntries

      public Stream<Map.Entry<IRI,IRI>> mappedEntries()
      Gets the mappings of ontology IRIs that this mapper has found.
      Returns:
      A Stream of map entries, from logical to physical IRI
    • getDocumentIRI

      @Nullable public IRI getDocumentIRI(IRI ontologyIRI)
      Description copied from interface: OWLOntologyIRIMapper
      Given an ontology IRI, this method maps the ontology IRI to a document IRI.
      Specified by:
      getDocumentIRI in interface OWLOntologyIRIMapper
      Parameters:
      ontologyIRI - The ontology IRI to be mapped.
      Returns:
      The document IRI of the ontology, or null if the mapper doesn't have mapping for the specified ontology IRI.
    • oboMappings

      public Stream<Map.Entry<String,IRI>> oboMappings()
      Returns:
      obo mappings
    • iriMappings

      public Stream<Map.Entry<IRI,IRI>> iriMappings()
      Returns:
      iri mappings
    • startElement

      public void startElement(@Nullable String uri, @Nullable String localName, @Nullable String qName, @Nullable Attributes attributes) throws SAXException
      Specified by:
      startElement in interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
      Throws:
      SAXException
    • toString

      public String toString()
      Overrides:
      toString in class Object