cgp.translators
Class CGIFGenerator

java.lang.Object
  |
  +--cgp.translators.SimpleGenerator
        |
        +--cgp.translators.CGIFGenerator

public class CGIFGenerator
extends SimpleGenerator
implements notio.Generator

A CGIF Generator class.


Field Summary
private  boolean allowIncompleteRelations
          Flag indicating whether the generator should allow incomplete relations or throw an exception.
private static java.lang.String MARKER_TABLE_NAME
          Name of MarkerTable unit in context.
private static java.lang.String NEG_TYPE_LABEL
          Type label for negation relation type.
private  boolean supressGraphComments
          Flag indicating whether the generator should supress graph comments.
private  boolean supressNodeComments
          Flag indicating whether the generator should supress node comments.
private static boolean USE_LITERAL_CONCEPTS_IN_RELATORS
          Flag that enables 'inlining' of concepts within relations where possible.
 
Fields inherited from class cgp.translators.SimpleGenerator
conceptHierarchy, DEFINING_LABEL_TABLE_NAME, knowledgeBase, markerSet, relationHierarchy, translationContext, writer
 
Constructor Summary
CGIFGenerator()
           
 
Method Summary
(package private)  void Actor(notio.Actor actor, notio.translators.DefiningLabelTable definingLabelTable)
          Generates a actor to the output stream.
(package private)  void ActorComment(java.lang.String comment)
          Generates a actor comment to output stream.
(package private)  void Arc(notio.Concept argument, notio.translators.DefiningLabelTable definingLabelTable)
          Generates an arc to the output stream.
(package private)  void Concept(notio.Concept concept, notio.translators.DefiningLabelTable definingLabelTable)
          Generates a concept to the output stream.
(package private)  void ConceptComment(java.lang.String comment)
          Generates a concept comment to output stream.
(package private)  void ConceptType(notio.ConceptType conType)
          Generates a concept type to the output stream.
(package private)  void ConceptTypeDefinition(notio.ConceptTypeDefinition typeDef)
          Generates a concept type definition to the output stream.
(package private)  void Designator(notio.Designator designator, notio.translators.DefiningLabelTable definingLabelTable)
          Generates a designator to the output stream.
 void generateActor(notio.Actor actor)
          Generates an actor to the output stream.
 void generateConcept(notio.Concept concept)
          Generates a concept to the output stream.
 void generateGraph(notio.Graph graph)
          Generates a graph to the output stream.
 void generateOutermostContext(notio.Graph graph)
          Generates a graph to the output stream.
 void generateRelation(notio.Relation relation)
          Generates a relation to the output stream.
 boolean getAllowIncompleteRelations()
          Returns a flag indicating whether incomplete relations are allowed whilst generating.
 boolean getSupressGraphComments()
          Returns a flag indicating whether this generator will supress comments in graphs.
 boolean getSupressNodeComments()
          Returns a flag indicating whether this generator will supress comments in nodes (Concepts, Relations, and Actors).
(package private)  void Graph(notio.Graph graph, notio.translators.DefiningLabelTable definingLabelTable)
          Generates a graph to the output stream.
(package private)  void GraphComment(java.lang.String comment)
          Generates a graph comment to output stream.
 void initializeGenerator(java.io.Writer newWriter, notio.KnowledgeBase newKnowledgeBase, notio.TranslationContext newTranslationContext)
          Initializes the generator to write to the specified writer using the specified TranslationContext and KnowledgeBase.
(package private)  void LiteralDesignator(notio.LiteralDesignator designator)
          Generates a literal designator to output stream.
(package private)  void MarkerDesignator(notio.MarkerDesignator designator)
          Generates a marker designator to output stream.
(package private)  void NameDesignator(notio.NameDesignator designator)
          Generates a name designator to output stream.
(package private)  void Quantifier(notio.Macro quantifier)
          Generates a quantifier to the output stream.
(package private)  void Referent(notio.Referent referent, notio.translators.DefiningLabelTable definingLabelTable)
          Generates a referent to the output stream.
(package private)  void Relation(notio.Relation relation, notio.translators.DefiningLabelTable definingLabelTable)
          Generates a relation to the output stream.
(package private)  void RelationComment(java.lang.String comment)
          Generates a relation comment to output stream.
(package private)  void RelationType(notio.RelationType relType)
          Generates a relation type to the output stream.
(package private)  void RelationTypeDefinition(notio.RelationTypeDefinition typeDef)
          Generates a relation type definition to the output stream.
 void setAllowIncompleteRelations(boolean flag)
          Sets a flag indicating whether incomplete relations are allowed whilst generating.
 void setSupressGraphComments(boolean flag)
          Sets a flag indicating whether this generator should supress comments in graphs.
 void setSupressNodeComments(boolean flag)
          Sets a flag indicating whether this generator should supress comments in nodes (Concepts, Relations, and Actors).
 
Methods inherited from class cgp.translators.SimpleGenerator
escapeCharactersInString, generate, generateUnit, getDefiningLabelTable, getUnitClass, initializeGenerator
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MARKER_TABLE_NAME

private static final java.lang.String MARKER_TABLE_NAME
Name of MarkerTable unit in context.

NEG_TYPE_LABEL

private static final java.lang.String NEG_TYPE_LABEL
Type label for negation relation type.

USE_LITERAL_CONCEPTS_IN_RELATORS

private static final boolean USE_LITERAL_CONCEPTS_IN_RELATORS
Flag that enables 'inlining' of concepts within relations where possible.

allowIncompleteRelations

private boolean allowIncompleteRelations
Flag indicating whether the generator should allow incomplete relations or throw an exception.

supressNodeComments

private boolean supressNodeComments
Flag indicating whether the generator should supress node comments.

supressGraphComments

private boolean supressGraphComments
Flag indicating whether the generator should supress graph comments.
Constructor Detail

CGIFGenerator

public CGIFGenerator()
Method Detail

initializeGenerator

public void initializeGenerator(java.io.Writer newWriter,
                                notio.KnowledgeBase newKnowledgeBase,
                                notio.TranslationContext newTranslationContext)
                         throws notio.GeneratorException
Initializes the generator to write to the specified writer using the specified TranslationContext and KnowledgeBase.
Specified by:
initializeGenerator in interface notio.Generator
Overrides:
initializeGenerator in class SimpleGenerator
Parameters:
newWriter - the writer to be generated to.
newKnowledgeBase - the knowledge base to be used while generating.
newTranslationContext - the translationContext to be used while generating.

setAllowIncompleteRelations

public void setAllowIncompleteRelations(boolean flag)
Sets a flag indicating whether incomplete relations are allowed whilst generating. If this flag is false, a GeneratorException will be thrown when an incomplete relation is encountered. If it is true, any incomplete arguments will simply be skipped as if they did not exist. If incomplete relations are allowed there is no guarantee that any CGIF parser will accept the generate output if it enforces relation valence or type definitions. The default setting for this flag is false.
Parameters:
flag - the new value for the flag.
See Also:
Relation.isComplete()

getAllowIncompleteRelations

public boolean getAllowIncompleteRelations()
Returns a flag indicating whether incomplete relations are allowed whilst generating. If this flag is false, a GeneratorException will be thrown when an incomplete relation is encountered. If it is true, any incomplete arguments will simply be skipped as if they did not exist. If incomplete relations are allowed there is no guarantee that any CGIF parser will accept the generate output if it enforces relation valence or type definitions. The default setting for this flag is false.
Returns:
the value for the flag.
See Also:
Relation.isComplete()

setSupressNodeComments

public void setSupressNodeComments(boolean flag)
Sets a flag indicating whether this generator should supress comments in nodes (Concepts, Relations, and Actors). The default setting for this flag is false.
Parameters:
flag - the new value for the flag.

getSupressNodeComments

public boolean getSupressNodeComments()
Returns a flag indicating whether this generator will supress comments in nodes (Concepts, Relations, and Actors). The default setting for this flag is false.
Returns:
the value for the flag.

setSupressGraphComments

public void setSupressGraphComments(boolean flag)
Sets a flag indicating whether this generator should supress comments in graphs. The default setting for this flag is false.
Parameters:
flag - the new value for the flag.

getSupressGraphComments

public boolean getSupressGraphComments()
Returns a flag indicating whether this generator will supress comments in graphs. The default setting for this flag is false.
Returns:
the value for the flag.

generateOutermostContext

public void generateOutermostContext(notio.Graph graph)
                              throws notio.GeneratorException
Generates a graph to the output stream.
Specified by:
generateOutermostContext in interface notio.Generator
Parameters:
graph - the graph to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

generateGraph

public void generateGraph(notio.Graph graph)
                   throws notio.GeneratorException
Generates a graph to the output stream.
Specified by:
generateGraph in interface notio.Generator
Parameters:
graph - the graph to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

generateConcept

public void generateConcept(notio.Concept concept)
                     throws notio.GeneratorException
Generates a concept to the output stream.
Specified by:
generateConcept in interface notio.Generator
Parameters:
concept - the concept to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

generateRelation

public void generateRelation(notio.Relation relation)
                      throws notio.GeneratorException
Generates a relation to the output stream.
Specified by:
generateRelation in interface notio.Generator
Parameters:
relation - the relation to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

generateActor

public void generateActor(notio.Actor actor)
                   throws notio.GeneratorException
Generates an actor to the output stream.
Specified by:
generateActor in interface notio.Generator
Parameters:
relation - the relation to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

Graph

void Graph(notio.Graph graph,
           notio.translators.DefiningLabelTable definingLabelTable)
     throws notio.GeneratorException
Generates a graph to the output stream.
Parameters:
graph - the graph to be generated.
definingLabelTable - the current defining label table.
Throws:
notio.GeneratorException - if an error occurs while generating.

GraphComment

void GraphComment(java.lang.String comment)
            throws notio.GeneratorException
Generates a graph comment to output stream.
Parameters:
comment - the graph comment to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

Concept

void Concept(notio.Concept concept,
             notio.translators.DefiningLabelTable definingLabelTable)
       throws notio.GeneratorException
Generates a concept to the output stream.
Parameters:
concept - the concept to be generated.
definingLabelTable - the current defining label table.
Throws:
notio.GeneratorException - if an error occurs while generating.

ConceptType

void ConceptType(notio.ConceptType conType)
           throws notio.GeneratorException
Generates a concept type to the output stream.
Parameters:
conType - the concept type to be generated.
Throws:
notio.GeneratorException - if an IO error occurs.

ConceptTypeDefinition

void ConceptTypeDefinition(notio.ConceptTypeDefinition typeDef)
                     throws notio.GeneratorException
Generates a concept type definition to the output stream.
Parameters:
typeDef - the concept type definition to be generated.
Throws:
notio.GeneratorException - if an IO error occurs.

Referent

void Referent(notio.Referent referent,
              notio.translators.DefiningLabelTable definingLabelTable)
        throws notio.GeneratorException
Generates a referent to the output stream.
Parameters:
referent - the referent to be generated.
definingLabelTable - the current defining label table.
Throws:
notio.GeneratorException - if an IO error occurs.

Quantifier

void Quantifier(notio.Macro quantifier)
          throws notio.GeneratorException
Generates a quantifier to the output stream. This now uses pCG's quantifier classes. [dbenn]
Parameters:
quantifier - the quantifier to be generated.
Throws:
notio.GeneratorException - if an IO error occurs.

Designator

void Designator(notio.Designator designator,
                notio.translators.DefiningLabelTable definingLabelTable)
          throws notio.GeneratorException
Generates a designator to the output stream.
Parameters:
designator - the designator to be generated.
definingLabelTable - the current defining label table.
Throws:
notio.GeneratorException - if an error occurs while generating.

LiteralDesignator

void LiteralDesignator(notio.LiteralDesignator designator)
                 throws notio.GeneratorException
Generates a literal designator to output stream.
Parameters:
designator - the designator to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

MarkerDesignator

void MarkerDesignator(notio.MarkerDesignator designator)
                throws notio.GeneratorException
Generates a marker designator to output stream.
Parameters:
designator - the designator to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

NameDesignator

void NameDesignator(notio.NameDesignator designator)
              throws notio.GeneratorException
Generates a name designator to output stream.
Parameters:
designator - the designator to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

ConceptComment

void ConceptComment(java.lang.String comment)
              throws notio.GeneratorException
Generates a concept comment to output stream.
Parameters:
comment - the concept comment to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

Relation

void Relation(notio.Relation relation,
              notio.translators.DefiningLabelTable definingLabelTable)
        throws notio.GeneratorException
Generates a relation to the output stream.
Parameters:
relation - the relation to be generated.
definingLabelTable - the current defining label table.
Throws:
notio.GeneratorException - if an error occurs while generating.

RelationType

void RelationType(notio.RelationType relType)
            throws notio.GeneratorException
Generates a relation type to the output stream.
Parameters:
relType - the relation type to be generated.
Throws:
notio.GeneratorException - if an IO error occurs.

RelationTypeDefinition

void RelationTypeDefinition(notio.RelationTypeDefinition typeDef)
                      throws notio.GeneratorException
Generates a relation type definition to the output stream.
Parameters:
typeDef - the relation type definition to be generated.
Throws:
notio.GeneratorException - if an IO error occurs.

Arc

final void Arc(notio.Concept argument,
               notio.translators.DefiningLabelTable definingLabelTable)
        throws notio.GeneratorException
Generates an arc to the output stream.
Parameters:
argument - the relation argument to be generated.
definingLabelTable - the current defining label table.
Throws:
notio.GeneratorException - if an error occurs while generating.

RelationComment

void RelationComment(java.lang.String comment)
               throws notio.GeneratorException
Generates a relation comment to output stream.
Parameters:
comment - the relation comment to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.

Actor

void Actor(notio.Actor actor,
           notio.translators.DefiningLabelTable definingLabelTable)
     throws notio.GeneratorException
Generates a actor to the output stream.
Parameters:
actor - the actor to be generated.
definingLabelTable - the current defining label table.
Throws:
notio.GeneratorException - if an error occurs while generating.

ActorComment

void ActorComment(java.lang.String comment)
            throws notio.GeneratorException
Generates a actor comment to output stream.
Parameters:
comment - the actor comment to be generated.
Throws:
notio.GeneratorException - if an error occurs while generating.