notio.translators
Class CGIFParser

java.lang.Object
  |
  +--notio.translators.CGIFParser
All Implemented Interfaces:
Parser

public class CGIFParser
extends java.lang.Object
implements Parser

A CGIF Parser class.


Constructor Summary
CGIFParser()
           
 
Method Summary
 boolean getCreateTypesOnDemand()
          This method may be used to check whether the parser will create type objects for any parsed type labels not currently in the database, or throw an exception.
 java.lang.Class getUnitClass()
          Returns the unit object parsed from the input stream.
 void initializeParser(java.io.Reader reader, KnowledgeBase kBase, TranslationContext tContext)
          Initializes the parser to parse the specified reader.
 Actor parseActor()
          Attempts to parse an actor from the input stream.
 java.util.Vector parseCGStream()
          Attempts to parse a CGStream from the input stream.
 Concept parseConcept()
          Attempts to parse a concept from the input stream.
 Graph parseGraph()
          Attempts to parse a graph from the input stream.
 Graph parseOutermostContext()
          Attempts to parse a graph which is treated as the outermost context for purposes for scoping.
 Relation parseRelation()
          Attempts to parse a relation from the input stream.
 java.lang.Object parseUnit()
          Attempts to parse the default unit from the input stream.
 void setCreateTypesOnDemand(boolean flag)
          This method may be used to tell the parser whether it should create type objects for any parsed type labels not currently in the database, or throw an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CGIFParser

public CGIFParser()
Method Detail

initializeParser

public void initializeParser(java.io.Reader reader,
                             KnowledgeBase kBase,
                             TranslationContext tContext)
                      throws ParserException
Initializes the parser to parse the specified reader.
Specified by:
initializeParser in interface Parser
Parameters:
reader - the reader whose contents are to be parsed.
kBase - the knowledge base to be used while parsing.
tContext - the translation context to be used while parsing.
Throws:
ParserException - if an error occurs while initializing the parser.

getUnitClass

public java.lang.Class getUnitClass()
Returns the unit object parsed from the input stream.
Specified by:
getUnitClass in interface Parser
Returns:
the unit object parsed from the input stream.

parseUnit

public java.lang.Object parseUnit()
                           throws ParserException
Attempts to parse the default unit from the input stream. The default unit is whatever a particular parser is usually intended to parse.
Specified by:
parseUnit in interface Parser
Returns:
the unit object parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.

parseOutermostContext

public Graph parseOutermostContext()
                            throws ParserException
Attempts to parse a graph which is treated as the outermost context for purposes for scoping. This method should be used instead of parseGraph() when no translation information is to be used from previous translation sessions and when the parser can safely assume that the graph is "self-contained".
Specified by:
parseOutermostContext in interface Parser
Returns:
the graph parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

parseCGStream

public java.util.Vector parseCGStream()
                               throws ParserException
Attempts to parse a CGStream from the input stream.
Specified by:
parseCGStream in interface Parser
Returns:
a vector of graphs parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.

parseGraph

public Graph parseGraph()
                 throws ParserException
Attempts to parse a graph from the input stream.
Specified by:
parseGraph in interface Parser
Returns:
the graph parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.

parseConcept

public Concept parseConcept()
                     throws ParserException
Attempts to parse a concept from the input stream.
Specified by:
parseConcept in interface Parser
Returns:
the concept parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.

parseRelation

public Relation parseRelation()
                       throws ParserException
Attempts to parse a relation from the input stream.
Specified by:
parseRelation in interface Parser
Returns:
the relation parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.

parseActor

public Actor parseActor()
                 throws ParserException
Attempts to parse an actor from the input stream.
Specified by:
parseActor in interface Parser
Returns:
the actor parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

setCreateTypesOnDemand

public void setCreateTypesOnDemand(boolean flag)
This method may be used to tell the parser whether it should create type objects for any parsed type labels not currently in the database, or throw an exception. Created types have only the universal and absurd types as parents and children respectively. The flag is true by default.
Parameters:
flag - true or false to turn automatic creation on or off.

getCreateTypesOnDemand

public boolean getCreateTypesOnDemand()
This method may be used to check whether the parser will create type objects for any parsed type labels not currently in the database, or throw an exception. This flag is set using setCreateTypesOnDemand().
Returns:
true if types will created on demand or false if an exception will be thrown.


Copyright 1998-2001 Finnegan Southey