Class AutoIRIMapper

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

@HasPriority(1.0) public class AutoIRIMapper extends DefaultHandler implements OWLOntologyIRIMapper, Serializable
A mapper which given a root folder attempts to automatically discover and map files to ontologies. The mapper is capable of mapping ontologies in RDF/XML, OWL/XML, Manchester OWL Syntax, Functional Syntax and OBO (other serialisations are not supported). Zip and jar files containing ontologies are supported, either as main argument to the constructor or as content of the root folder.
Since:
2.0.0
Author:
Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
See Also:
  • Constructor Details

    • AutoIRIMapper

      public AutoIRIMapper(File rootDirectory, boolean recursive)
      Creates an auto-mapper which examines ontologies that reside in the specified root folder (and possibly sub-folders).
      Parameters:
      rootDirectory - The root directory which should be searched for ontologies; this can also be a zip/jar file containing ontologies. If root is actually a folder, zip/jar files included in the folder are parsed for ontologies. The zip parsing is delegated to ZipIRIMapper.
      recursive - Sub directories will be searched recursively if true.
  • 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
    • getOntologyIRIs

      public Set<IRI> getOntologyIRIs()
      Gets the set of ontology IRIs that this mapper has found.
      Returns:
      A Set of ontology (logical) IRIs
    • update

      public void update()
      update the map.
    • 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.
    • 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