|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.semanticweb.owl.io.abstract_syntax.AbstractOWLParser
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:
Namespace(people=<http://cohse.semanticweb.org/ontologies/people#>)
Ontology(
ObjectProperty(people:has_pet)
Individual(people:fred value(people:has_pet people:felix))
)
Namespace(people=<http://cohse.semanticweb.org/ontologies/people#>)
Ontology(
Individual(people:fred value(people:has_pet people:felix))
ObjectProperty(people:has_pet)
)
| 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 |
public static final String RDF
public static final String XSD
public static final String RDFS
public static final String OWL
| Constructor Detail |
public AbstractOWLParser()
AbstractOWLParser
and sets the builder property to a new OWLBuilder
with default OWLConnection.
public AbstractOWLParser(OWLConnection connection)
AbstractOWLParser and
sets the builder property to a new OWLBuilder with
connection as OWLConnection.
connection - the OWLConnection for the OWLBuilder.| Method Detail |
public ANTLRParser getANTLRParser()
public void setANTLRParser(ANTLRParser newAntlrParser)
newAntlrParser - The new ANTLRParser value.public OWLBuilder getBuilder()
public void setBuilder(OWLBuilder newBuilder)
newBuilder - The new OWLBuilder value.public OWLConnection getConnection()
OWLConnection.
This is held in the OWLBuilder.
getConnection in interface ParserOWLConnection.public void setConnection(OWLConnection newConnection)
setConnection in interface ParsernewConnection - The new OWLConnection value.
public OWLOntology parseOntology(URI uri)
throws ParserException
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.
parseOntology in interface Parseruri - a URI corresponding
to an ontology.
OWLOntology corresponding to parsed ontology.
ParserException - if an error occurs
public OWLOntology parseOntology(Reader reader,
URI physicalURI)
throws ParserException
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.
parseOntology in interface Parserreader - a Reader containing an ontology.physicalURI - the physical URI corresponding
to the ontology in the reader.
OWLOntology corresponding to parsed ontology.
ParserException - if an error occurspublic void setOptions(Map newOptions)
options Map
setOptions in interface OptionsnewOptions - the new options Map.public Map getOptions()
options Map.
getOptions in interface OptionsMap with the options.
public OWLDescription parseDescription(Reader descriptionReader)
throws OWLException,
antlr.RecognitionException,
antlr.TokenStreamException,
FileNotFoundException,
IOException,
ParserException
descriptionReader
and returns the corresponding OWLDescription.
descriptionReader - a Reader holding a description.
OWLDescription corresponding to the parsing
of the description in descriptionReader.
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
public OWLDescription parseDescription(String descriptionString)
throws OWLException,
antlr.RecognitionException,
antlr.TokenStreamException,
FileNotFoundException,
IOException,
ParserException
descriptionString
and returns the corresponding OWLDescription.
descriptionString - a description String.
OWLDescription corresponding to the parsing
of the description in descriptionReader.
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 occurspublic static void main(String[] args)
args - one argument - a URI - required.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||