org.semanticweb.owlapi.util
Class AutoIRIMapper

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

public class AutoIRIMapper
extends org.xml.sax.helpers.DefaultHandler
implements OWLOntologyIRIMapper

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 26-Apr-2007

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).


Constructor Summary
AutoIRIMapper(java.io.File rootDirectory, boolean recursive)
          Creates an auto-mapper which examines ontologies that reside in the specified root folder (and possibly sub-folders).
 
Method Summary
 IRI getDocumentIRI(IRI ontologyIRI)
          Given an ontology IRI, this method maps the ontology IRI to a document IRI.
 java.util.Set<java.lang.String> getFileExtensions()
          The mapper only examines files that have specified file extensions.
 java.util.Set<IRI> getOntologyIRIs()
          Gets the set of ontology IRIs that this mapper has found
 void setFileExtensions(java.util.Set<java.lang.String> extensions)
          Sets the extensions of files that are to be examined for ontological content.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 java.lang.String toString()
           
 void update()
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AutoIRIMapper

public AutoIRIMapper(java.io.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.
recursive - Sub directories will be searched recursively if true.
Method Detail

getFileExtensions

public java.util.Set<java.lang.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(java.util.Set<java.lang.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.


getOntologyIRIs

public java.util.Set<IRI> getOntologyIRIs()
Gets the set of ontology IRIs that this mapper has found

Returns:
A Set of ontology (logical) URIs

update

public void update()

getDocumentIRI

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(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object