Package org.semanticweb.owlapi.util
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 Summary
ConstructorsConstructorDescriptionAutoIRIMapper
(File rootDirectory, boolean recursive) Creates an auto-mapper which examines ontologies that reside in the specified root folder (and possibly sub-folders). -
Method Summary
Modifier and TypeMethodDescriptiongetDocumentIRI
(IRI ontologyIRI) Given an ontology IRI, this method maps the ontology IRI to a document IRI.The mapper only examines files that have specified file extensions.Gets the set of ontology IRIs that this mapper has found.void
setFileExtensions
(Collection<String> extensions) Sets the extensions of files that are to be examined for ontological content.void
startElement
(String uri, String localName, String qName, Attributes attributes) toString()
void
update()
update the map.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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
AutoIRIMapper
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 iftrue
.
-
-
Method Details
-
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
Sets the extensions of files that are to be examined for ontological content. (By default the extensions areowl
,xml
andrdf
). Only files that have the specified extensions will be examined to see if they contain ontologies.- Parameters:
extensions
- the set of extensions
-
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
Description copied from interface:OWLOntologyIRIMapper
Given an ontology IRI, this method maps the ontology IRI to a document IRI.- Specified by:
getDocumentIRI
in interfaceOWLOntologyIRIMapper
- 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 interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
toString
-