org.semanticweb.owl.util
Class AutoURIMapper

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.semanticweb.owl.util.AutoURIMapper
All Implemented Interfaces:
OWLOntologyURIMapper, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class AutoURIMapper
extends org.xml.sax.helpers.DefaultHandler
implements OWLOntologyURIMapper

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
AutoURIMapper(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
 java.util.Set<java.lang.String> getFileExtensions()
          The mapper only examines files that have specified file extensions.
 java.util.Set<java.net.URI> getOntologyURIs()
          Gets the set of ontology URIs that this mapper has found
 java.net.URI getPhysicalURI(java.net.URI ontologyURI)
          Given an ontology URI, this method maps the ontology URI to a physical URI that points to some concrete representation of the ontology.
 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

AutoURIMapper

public AutoURIMapper(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.


getOntologyURIs

public java.util.Set<java.net.URI> getOntologyURIs()
Gets the set of ontology URIs that this mapper has found

Returns:
A Set of ontology (logical) URIs

update

public void update()

getPhysicalURI

public java.net.URI getPhysicalURI(java.net.URI ontologyURI)
Description copied from interface: OWLOntologyURIMapper
Given an ontology URI, this method maps the ontology URI to a physical URI that points to some concrete representation of the ontology.

Specified by:
getPhysicalURI in interface OWLOntologyURIMapper
Parameters:
ontologyURI - The ontology URI to be mapped.
Returns:
The physical URI of the ontology, or null if the mapper doesn't have mapping for the specified ontology URI.

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