Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.semanticweb.owl.io.abstract_syntax
Class AbstractOWLParser

    java.lang.Object
      |
      +--org.semanticweb.owl.io.abstract_syntax.AbstractOWLParser

All Implemented Interfaces:
  Options, Parser

public class AbstractOWLParser
extends Object
implements Parser

OWL abstract syntax implementation of `Parser`. Delegates the actual parsing to the ANTLR generated `ANTLRParser` and the construction of the OWLOntology to an `OWLBuilder`.

Warning: `ObjectProperty` and `DatatypeProperty` entities have to be defined before they can be used. Eg:

- VALID

          Namespace(people=<http://cohse.semanticweb.org/ontologies/people#>)
          Ontology(
            ObjectProperty(people:has_pet)
            Individual(people:fred value(people:has_pet people:felix))
          )

- NOT VALID

          Namespace(people=<http://cohse.semanticweb.org/ontologies/people#>)
          Ontology(
            Individual(people:fred value(people:has_pet people:felix))
            ObjectProperty(people:has_pet)
          )

Version:
  $Id: AbstractOWLParser.java,v 1.3 2004/01/08 16:36:27 dturi Exp $

Field Summary
`static String` | `OWL` Value: "http://www.w3.org/2002/07/owl#"
`static String` | `RDF` Value: "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
`static String` | `RDFS` Value: "http://www.w3.org/2000/01/rdf-schema#"
`static String` | `XSD` Value: "http://www.w3.org/2001/XMLSchema#"

Constructor Summary
`AbstractOWLParser()` Creates a new `AbstractOWLParser` and sets the builder property to a new `OWLBuilder` with default OWLConnection.
`AbstractOWLParser(OWLConnection connection)` Creates a new `AbstractOWLParser` and sets the builder property to a new `OWLBuilder` with `connection` as OWLConnection.

Method Summary
`ANTLRParser` | `getANTLRParser()` Get the ANTLR generated parser that performs the actual parsing.
`OWLBuilder` | `getBuilder()` Get the OWLBuilder.
`OWLConnection` | `getConnection()` Gets the current `OWLConnection`.
`Map` | `getOptions()` Gets the `options` Map.
`static void` | `main(String[] args)` Parses an ontology (passed as a URI) and builds a corresponding abstract owl ontology.
`OWLDescription` | `parseDescription(Reader descriptionReader)` Parses the description in `descriptionReader` and returns the corresponding OWLDescription.
`OWLDescription` | `parseDescription(String descriptionString)` Parses `descriptionString` and returns the corresponding OWLDescription.
`OWLOntology` | `parseOntology(Reader reader, URI physicalURI)` Parses the ontology in `reader` and returns a new ontology object based on the connection that the parser knows about.
`OWLOntology` | `parseOntology(URI uri)` Parses the ontology at `uri` and returns a new ontology object based on the connection that the parser knows about.
`void` | `setANTLRParser(ANTLRParser newAntlrParser)` Set the ANTLRParser value.
`void` | `setBuilder(OWLBuilder newBuilder)` Set the OWLBuilder.
`void` | `setConnection(OWLConnection newConnection)` Set the value of the OWLConnection value.
`void` | `setOptions(Map newOptions)` Sets the `options` Map

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### RDF

    public static final String RDF

  Value: "http://www.w3.org/1999/02/22-rdf-syntax-ns#"

  See Also:
    Constant Field Values

### XSD

    public static final String XSD

  Value: "http://www.w3.org/2001/XMLSchema#"

  See Also:
    Constant Field Values

### RDFS

    public static final String RDFS

  Value: "http://www.w3.org/2000/01/rdf-schema#"

  See Also:
    Constant Field Values

### OWL

    public static final String OWL

  Value: "http://www.w3.org/2002/07/owl#"

  See Also:
    Constant Field Values

Constructor Detail

### AbstractOWLParser

    public AbstractOWLParser()

  Creates a new `AbstractOWLParser` and sets the builder property to a new `OWLBuilder` with default OWLConnection.

### AbstractOWLParser

    public AbstractOWLParser(OWLConnection connection)

  Creates a new `AbstractOWLParser` and sets the builder property to a new `OWLBuilder` with `connection` as OWLConnection.

Parameters:
  `connection` - the `OWLConnection` for the OWLBuilder.

Method Detail

### getANTLRParser

    public ANTLRParser getANTLRParser()

  Get the ANTLR generated parser that performs the actual parsing.

  Returns:
    the ANTLR generated parser that performs the actual parsing.

### setANTLRParser

    public void setANTLRParser(ANTLRParser newAntlrParser)

  Set the ANTLRParser value.

  Parameters:
    `newAntlrParser` - The new ANTLRParser value.

### getBuilder

    public OWLBuilder getBuilder()

  Get the OWLBuilder.

  Returns:
    the OWLBuilder.

### setBuilder

    public void setBuilder(OWLBuilder newBuilder)

  Set the OWLBuilder.

  Parameters:
    `newBuilder` - The new OWLBuilder value.

### getConnection

    public OWLConnection getConnection()

  Gets the current `OWLConnection`. This is held in the OWLBuilder.

  Specified by:
    `getConnection` in interface `Parser`
  Returns:
    the current `OWLConnection`.

### setConnection

    public void setConnection(OWLConnection newConnection)

  Set the value of the OWLConnection value. This is held in the OWLBuilder.

  Specified by:
    `setConnection` in interface `Parser`
  Parameters:
    `newConnection` - The new OWLConnection value.

### parseOntology

    public OWLOntology parseOntology(URI uri)
                              throws ParserException

  Parses the ontology at `uri` and returns a new ontology object based on the connection that the parser knows about. Also sets the physical URI of the resulting OWLOntology to `uri` and initialises the `namespaceTable` of the ANTLRParser with the predefined neamespaces.

  Specified by:
    `parseOntology` in interface `Parser`
  Parameters:
    `uri` - a `URI` corresponding to an ontology.
  Returns:
    the `OWLOntology` corresponding to parsed ontology.
  Throws:
    `ParserException` - if an error occurs

### parseOntology

    public OWLOntology parseOntology(Reader reader,
                                     URI physicalURI)
                              throws ParserException

  Parses the ontology in `reader` and returns a new ontology object based on the connection that the parser knows about. Also sets the physical URI of the resulting OWLOntology to physicalURI and initialises the `namespaceTable` of the ANTLRParser with the predefined neamespaces.

  Specified by:
    `parseOntology` in interface `Parser`
  Parameters:
    `reader` - a `Reader` containing an ontology.
    `physicalURI` - the physical `URI` corresponding to the ontology in the reader.
  Returns:
    the `OWLOntology` corresponding to parsed ontology.
  Throws:
    `ParserException` - if an error occurs

### setOptions

    public void setOptions(Map newOptions)

  Sets the `options` Map

  Specified by:
    `setOptions` in interface `Options`
  Parameters:
    `newOptions` - the new options `Map`.

### getOptions

    public Map getOptions()

  Gets the `options` Map.

  Specified by:
    `getOptions` in interface `Options`
  Returns:
    the `Map` with the options.

### parseDescription

    public OWLDescription parseDescription(Reader descriptionReader)
                                    throws OWLException,
                                           antlr.RecognitionException,
                                           antlr.TokenStreamException,
                                           FileNotFoundException,
                                           IOException,
                                           ParserException

  Parses the description in `descriptionReader` and returns the corresponding OWLDescription.

  Parameters:
    `descriptionReader` - a `Reader` holding a description.
  Returns:
    the `OWLDescription` corresponding to the parsing of the description in `descriptionReader`.
  Throws:
    `OWLException` - if an error occurs
    `antlr.RecognitionException` - if an error occurs
    `antlr.TokenStreamException` - if an error occurs
    `FileNotFoundException` - if an error occurs
    `IOException` - if an error occurs
    `ParserException` - if an error occurs

### parseDescription

    public OWLDescription parseDescription(String descriptionString)
                                    throws OWLException,
                                           antlr.RecognitionException,
                                           antlr.TokenStreamException,
                                           FileNotFoundException,
                                           IOException,
                                           ParserException

  Parses `descriptionString` and returns the corresponding OWLDescription.

  Parameters:
    `descriptionString` - a description String.
  Returns:
    the `OWLDescription` corresponding to the parsing of the description in `descriptionReader`.
  Throws:
    `OWLException` - if an error occurs
    `antlr.RecognitionException` - if an error occurs
    `antlr.TokenStreamException` - if an error occurs
    `FileNotFoundException` - if an error occurs
    `IOException` - if an error occurs
    `ParserException` - if an error occurs

### main

    public static void main(String[] args)

  Parses an ontology (passed as a URI) and builds a corresponding abstract owl ontology.

  Parameters:
    `args` - one argument - a URI - required.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WonderWeb