org.semanticweb.owlapi.io
Class AbstractOWLParser

java.lang.Object
  extended by org.semanticweb.owlapi.io.AbstractOWLParser
All Implemented Interfaces:
OWLParser
Direct Known Subclasses:
KRSS2OWLParser, KRSSOWLParser, ManchesterOWLSyntaxOntologyParser, OWLFunctionalSyntaxOWLParser, OWLOBOParser, OWLXMLParser, RDFXMLParser, TurtleOntologyParser

public abstract class AbstractOWLParser
extends java.lang.Object
implements OWLParser

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 14-Nov-2006

A convenience base class for parsers, which provides a mechanism to manage the setting and getting of the OWLOntologyManager that should be associated with the parser


Constructor Summary
protected AbstractOWLParser()
           
 
Method Summary
protected  org.xml.sax.InputSource getInputSource(OWLOntologyDocumentSource documentSource)
           
protected  java.io.InputStream getInputStream(IRI documentIRI)
          A convenience method that obtains an input stream from a URI.
 OWLOntologyManager getOWLOntologyManager()
           
protected  java.lang.String getRequestTypes()
           
 OWLOntologyFormat parse(IRI documentIRI, OWLOntology ontology)
          Parses the ontology that has a concrete representation which is pointed to by the specified document IRI.
 void setOWLOntologyManager(OWLOntologyManager owlOntologyManager)
          Sets the OWLOntologyManager which should be used to load imports etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.semanticweb.owlapi.io.OWLParser
parse
 

Constructor Detail

AbstractOWLParser

protected AbstractOWLParser()
Method Detail

setOWLOntologyManager

public void setOWLOntologyManager(OWLOntologyManager owlOntologyManager)
Description copied from interface: OWLParser
Sets the OWLOntologyManager which should be used to load imports etc.

Specified by:
setOWLOntologyManager in interface OWLParser

getOWLOntologyManager

public OWLOntologyManager getOWLOntologyManager()

getRequestTypes

protected java.lang.String getRequestTypes()

getInputStream

protected java.io.InputStream getInputStream(IRI documentIRI)
                                      throws java.io.IOException
A convenience method that obtains an input stream from a URI. This method sets up the correct request type and wraps the input stream within a buffered input stream

Parameters:
documentIRI - The URI from which the input stream should be returned
Returns:
The input stream obtained from the URI
Throws:
java.io.IOException - if there was an IOException in obtaining the input stream from the URI.

getInputSource

protected org.xml.sax.InputSource getInputSource(OWLOntologyDocumentSource documentSource)
                                          throws java.io.IOException
Throws:
java.io.IOException

parse

public OWLOntologyFormat parse(IRI documentIRI,
                               OWLOntology ontology)
                        throws OWLParserException,
                               java.io.IOException,
                               UnloadableImportException
Description copied from interface: OWLParser
Parses the ontology that has a concrete representation which is pointed to by the specified document IRI. Implementors of this method should load any imported ontologies with the loadImports method on OWLOntologyManager.

Specified by:
parse in interface OWLParser
Parameters:
documentIRI - The document IRI where the ontology should be loaded from
ontology - The ontology that the concrete representation should be parsed into. @return An OWLOntologyFormat which describes the concrete representation format which was parsed to obtain the ontology. This will never be null.
Returns:
The format of the ontology
Throws:
OWLParserException - if there was a problem parsing the ontology. This indicates an error in the syntax with this ontology document that the parser reads.
java.io.IOException - if there was an IOException during parsing
UnloadableImportException - if loading this ontology prompted the loading of an import and the import could not be loaded.