uvi
Class Generator

java.lang.Object
  extended by uvi.Generator

public class Generator
extends Object

This class is the driver for the UVI web page creation. It validates all the command-line arguments, reads in the VerbNet XML files one-by-one, performs validation, and generates the corresponding HTML files. Additional data sources are read from and all index pages are then created (with PB and FN links). This class contains all static members as the problem of parsing at this high a level does not map well onto an OOP paradigm. This javadoc documentation is targeted at future developers, not at people attempting to use an interface herein. All but one method in this program have 'private' scope (only main(String[]) is public). This class could have been forced into smaller modules, but for simplicity it is very long.

NOTE: Any reference to "HTML Files" should be taken as a synonym for "PHP Files." When this documentation was created, only *.html files were used. Later, they were converted to *.php files to facilitate dynamic content (i.e. comments).

NOTE: All the "See Also" links in this Javadoc documentation refer to other methods, variables, or classes which reference or are referenced *in the code* by the class member in question. It's not the normal usage of the Javadoc "See Also" links because this documentation is geared more towards future developers of this tool.

Version:
1.0, 2006.9.8
Author:
Derek Trumbo

Nested Class Summary
private static class Generator.InvalidCommandLineArgumentException
          Exception class for identifying when the user did not supply a command-line of the proper format.
private static class Generator.InvalidDirectoryException
          Exception class for identifying when the user did not supply both a valid XML input directory and a valid HTML output directory.
private static class Generator.InvalidSupplementalFilesException
          Exception class for identifying when the required supplemental directory or the files within cannot be found or read.
private static class Generator.MyFilter
          Decides which files to select for the File.listFiles() method of the File class.
private static class Generator.UserWantsHelpMessage
          Exception class for identifying when the user requests to view the help/usage message for the program.
private static class Generator.XMLErrorHandler
          Contains the methods called by the DocumentBuilder object in generateHTMLFiles() when an error is encountered with an XML file during the parsing thereof.
 
Field Summary
private static String[] allFlags
          An array of all possible flags that this program accepts.
(package private) static String classesWithSubclasses
          A string that holds in a list format all those XML files that contain subclasses.
(package private) static ArrayList classHierarchy
          A list of every class and subclass name in Verbnet.
(package private) static int DS_FRAMENET
          Used to identify FrameNet as a data source.
(package private) static int DS_GROUPING
          Used to identify the OntoNotes Sense Groupings as a data source.
(package private) static int DS_PROPBANK
          Used to identify PropBank as a data source.
(package private) static int DS_VERBNET
          Used to identify VerbNet as a data source.
(package private) static int DS_VN_CYC
          Used to identify the VerbNet-Cyc mapping as a data source.
(package private) static int DS_VN_FN
          Used to identify the VerbNet-FrameNet mapping as a data source.
(package private) static int DS_WORDNET
          Used to identify WordNet as a data source.
private static ArrayList flags
          An array of strings representing the flags passed to the program These are all of the command-line arguments that begin with a hypen ('-').
(package private) static boolean flCopyOnly
          A flag set in analyzeArguments(String[]) and used once only inside of generateHTMLFiles() to suppress the generation of the VerbNet class pages and the index pages.
(package private) static boolean flHelp
          A flag set in analyzeArguments(String[]) and used once only inside of said method.
(package private) static boolean flNoGen
          A flag set in analyzeArguments(String[]) and used only inside replaceSpecialSequences(String, String) to decide whether or not a link to the Generator's disclaimer page should be added to each index page, including the main index page.
(package private) static boolean flNoInsp
          A flag set in analyzeArguments(String[]) and used only inside replaceSpecialSequences(String, String) to decide whether or not a link to the Inspector's disclaimer page should be added to each index page, including the main index page.
(package private) static boolean flNoVxC
          A flag set in analyzeArguments(String[]) and used only inside replaceSpecialSequences(String, String) to decide whether or not a link to the VxC application's disclaimer page should be added to each index page, including the main index page.
(package private) static boolean flOverwrite
          A flag set in analyzeArguments(String[]) and used throughout the rest of the program.
(package private) static boolean flQuiet
          A flag set in analyzeArguments(String[]) and used throughout the rest of the program.
(package private) static boolean flSort
          A flag set in analyzeArguments(String[]) and used only inside Sweeper.startMEMBER(Node) to indicate whether or not to sort all the members for each class/subclass.
(package private) static boolean flVerbose
          A flag set in analyzeArguments(String[]) and used throughout the rest of the program.
(package private) static boolean flWithCyc
          A flag set in analyzeArguments(String[]) and used to decide if the VerbNet-Cyc data source should be used and its contents displayed.
(package private) static String fnURL
          The beginning portion of the URL which, when appended with a frame name, refers to the web page on FrameNet's web site that will display the proper frame.
(package private) static WordLists frameLists
          A special word list for the syntactic frame descriptions.
(package private) static String grpURL
          The beginning portion of the URL which, when appended with a grouping page refers to the web page for the given Ontonotes Sense Grouping verb.
private static File inDir
          The File object that represents the user's desired XML input directory.
private static ArrayList nonFlags
          An array of strings representing the non-flag command-line parameters.
private static File outDir
          The File object that represents the user's desired HTML output directory.
private static Map properties
          Holds the user-definable properties that will be read in from the properties.s supplemental file.
private static Calendar runTime
          The current date and time of the execution of this program.
private static Map sFiles
          Holds File objects in an associative array, keyed on the file names stored in sNames.
private static String[] sNames
          All of the supplemental files (supporting files) required by the program.
(package private) static int totalSubclasses
          A count of all subclasses in VerbNet, at any level (does not include main classes).
(package private) static WordLists wordLists
          A set of word lists constructed in the Sweeper class and accessed in this class.
private static File[] xmlFiles
          An array of File objects that represent all the XML files in the specified XML input directory.
 
Constructor Summary
private Generator()
          This constructor is private because the class is not intended to ever be instantiated.
 
Method Summary
private static void addOthers(int type)
          Reads in data from an alternate data source (one other than VerbNet).
private static void analyzeArguments(String[] args)
          Validates all of the command-line arguments and sets appropriate class-level variables.
private static void checkDTDFile()
          Makes sure there is at least one DTD file in the XML input directory.
private static void checkSupplementalFiles()
          Makes sure all required supplemental files exist.
private static void closeHTMLOutStream(PrintWriter outWriter, String fileName)
          Closes the output stream to a file.
private static int compareFirstNumber(String nx, String ny)
          Helps with sorting the class hierarchy.
private static void copyFile(File src, File dest)
          Performs a low-level copy of one file into another.
private static void copySupplementalFiles()
          Copies the supplemental files that belong in the HTML output directory to that directory.
private static PrintWriter createHTMLOutStream(String fileName)
          Creates a new output file and returns an output stream to it.
private static PrintWriter createHTMLOutStream(String fileName, String startWithFile)
          Creates a new output file and returns an output stream to it.
private static PrintWriter createHTMLOutStream(String fileName, String startWithFile, String startWithFile2)
          Creates a new output file and returns an output stream to it.
private static void createSubdirectories()
          Creates the two subdirectories that the UVI utilizes for comments and users.
protected static File createSubdirectory(String dirName)
           
private static void eprint(String s)
          Used as shorthand for System.err.print.
private static void eprintln(String s)
          Used as shorthand for System.err.println.
private static void executeHTMLMethod(String which, Node n)
          Executes a method in the Sweeper class based on a node tag name (i.e. 'VNCLASS') and a 'start' or 'end' flag.
private static boolean existsFlag(String flag)
          Checks whether the given flag was supplied by the user.
private static String filePath(File f)
          Returns a descriptive path for a File object.
private static void generateClassHierarchy()
          Creates a page that displays the complete class hierarchy for VerbNet.
private static void generateHTMLFiles()
          Completes the filling of the HTML output directory of all files, pre-made ones and generated ones.
private static void generateIndexFiles()
          Creates the main index page and index pages for each letter of the alphabet.
private static void generateOneFile(DocumentBuilder db, File src)
          Creates the content of the HTML output file using the source XML file and the Java Document Object Model.
private static void generateReferencePage()
          Creates a page that displays the field information collected during the generation phase.
static String getProperty(String propertyName, String defaultValue)
           
static void main(String[] args)
          Drives the entire generation process.
private static void print(String s)
          Used as shorthand for System.out.print.
private static void printEndInfo()
          Prints information after the HTML generation process has completed.
private static void println(String s)
          Used as shorthand for System.out.println.
private static void printReferenceColumn(String title, String list)
          Prints an HTML TD element containing a selected word list.
private static void printReferenceColumnSpecial(String title)
          Prints an HTML TD element containing the special word list for the frame descriptions.
private static void printStartInfo()
          Prints information before the HTML generation process has completed.
private static void printSupplemental()
          Prints the information about the contents of the required supplemental directory.
private static void printUsage()
          Prints the usage message.
private static void processNode(Node n)
          This method starts by outputting the HTML code you would want to output upon encountering the start of the given node, then recursively prints all the HTML associated with this node's children nodes, and finally outputs the HTML needed for the close of the given node.
private static void readProperties()
          Reads key-value pairs out of the properties.s supplemental file.
private static String replaceSpecialSequences(String line, String fileName)
          Replaces all special sequences in a given line of text with corresponding real-world values.
private static String sameSlash(String p)
          Ensures that a path only contains the separator character for the given OS on which the program is run.
private static void sortXMLFiles()
          Sorts the already loaded XML files array xmlFiles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fnURL

static final String fnURL
The beginning portion of the URL which, when appended with a frame name, refers to the web page on FrameNet's web site that will display the proper frame. This is used when constructing the index and when adding links for the VN-FN mapping on each individual verb class page.

See Also:
generateIndexFiles(), Sweeper.printMembers(), Constant Field Values

grpURL

static final String grpURL
The beginning portion of the URL which, when appended with a grouping page refers to the web page for the given Ontonotes Sense Grouping verb. This is used when adding links for the groupings on each individual verb class page.

See Also:
generateIndexFiles(), Sweeper.printMembers(), Constant Field Values

DS_VERBNET

static final int DS_VERBNET
Used to identify VerbNet as a data source.

See Also:
generateIndexFiles(), Sweeper.printMembers(), Constant Field Values

DS_PROPBANK

static final int DS_PROPBANK
Used to identify PropBank as a data source.

See Also:
generateHTMLFiles(), addOthers(int), Constant Field Values

DS_FRAMENET

static final int DS_FRAMENET
Used to identify FrameNet as a data source.

See Also:
generateHTMLFiles(), addOthers(int), Constant Field Values

DS_WORDNET

static final int DS_WORDNET
Used to identify WordNet as a data source.

See Also:
generateHTMLFiles(), addOthers(int), Constant Field Values

DS_VN_FN

static final int DS_VN_FN
Used to identify the VerbNet-FrameNet mapping as a data source.

See Also:
generateHTMLFiles(), addOthers(int), Constant Field Values

DS_VN_CYC

static final int DS_VN_CYC
Used to identify the VerbNet-Cyc mapping as a data source.

See Also:
generateHTMLFiles(), addOthers(int), Constant Field Values

DS_GROUPING

static final int DS_GROUPING
Used to identify the OntoNotes Sense Groupings as a data source.

See Also:
generateHTMLFiles(), addOthers(int), Constant Field Values

sNames

private static String[] sNames
All of the supplemental files (supporting files) required by the program. These files must be present in the directory 'supplemental' at the time of the program's execution. See the README file for the purpose and format of each file.

See Also:
printSupplemental(), checkSupplementalFiles(), copySupplementalFiles()

sFiles

private static Map sFiles
Holds File objects in an associative array, keyed on the file names stored in sNames. This is loaded up as the supplemental files are being checked and used primarily for convenience in referencing the above files.

See Also:
checkSupplementalFiles(), generateHTMLFiles(), createHTMLOutStream(String, String, String), closeHTMLOutStream(PrintWriter, String)

properties

private static Map properties
Holds the user-definable properties that will be read in from the properties.s supplemental file.


flags

private static ArrayList flags
An array of strings representing the flags passed to the program These are all of the command-line arguments that begin with a hypen ('-'). This array is loaded in analyzeArguments(String[]) referenced in printStartInfo(). They are printed in the starting banner of the program.

See Also:
analyzeArguments(String[]), printStartInfo(), printUsage(), existsFlag(String)

nonFlags

private static ArrayList nonFlags
An array of strings representing the non-flag command-line parameters. This array should hold only the XML input directory and the HTML output directory, and will be validated as such. The first element of the array will be considered the XML input directory and the second element the HTML output directory. This variable does not need to be class-level; it could be local.

See Also:
analyzeArguments(String[])

allFlags

private static String[] allFlags
An array of all possible flags that this program accepts. Each flag has both a short form and a long form. All supplied flags are validated against this array and the existence of any unknown flags triggers an exception. This variable does not need to be class-level; it could be local.

See Also:
analyzeArguments(String[])

flHelp

static boolean flHelp
A flag set in analyzeArguments(String[]) and used once only inside of said method. It is class-level for documentation purposes only. This flag is set if the user specifies they would like to see the help for the tool. If the user places a '-?' or '--help' anywhere on the command line then this flag is set to true, the usage message is displayed and the program exits.

See Also:
analyzeArguments(String[]), printUsage()

flVerbose

static boolean flVerbose
A flag set in analyzeArguments(String[]) and used throughout the rest of the program. If this variable is set to true, more output is generated than otherwise.

See Also:
analyzeArguments(String[]), generateHTMLFiles(), generateIndexFiles()

flQuiet

static boolean flQuiet
A flag set in analyzeArguments(String[]) and used throughout the rest of the program. If this variable is set to true, only error and warning messages will be sent to standard out. This flag overrides flVerbose.

See Also:
main(String[]), analyzeArguments(String[]), generateHTMLFiles(), generateIndexFiles()

flOverwrite

static boolean flOverwrite
A flag set in analyzeArguments(String[]) and used throughout the rest of the program. If this variable is set to true, the program will write over existing files that it needs to create. If this flag is not specified then the program will not destroy existing files.

See Also:
analyzeArguments(String[]), createHTMLOutStream(String, String, String), copySupplementalFiles()

flNoGen

static boolean flNoGen
A flag set in analyzeArguments(String[]) and used only inside replaceSpecialSequences(String, String) to decide whether or not a link to the Generator's disclaimer page should be added to each index page, including the main index page.

See Also:
analyzeArguments(String[]), replaceSpecialSequences(String, String), generateIndexFiles()

flNoInsp

static boolean flNoInsp
A flag set in analyzeArguments(String[]) and used only inside replaceSpecialSequences(String, String) to decide whether or not a link to the Inspector's disclaimer page should be added to each index page, including the main index page.

See Also:
analyzeArguments(String[]), replaceSpecialSequences(String, String), generateIndexFiles()

flNoVxC

static boolean flNoVxC
A flag set in analyzeArguments(String[]) and used only inside replaceSpecialSequences(String, String) to decide whether or not a link to the VxC application's disclaimer page should be added to each index page, including the main index page.

See Also:
analyzeArguments(String[]), replaceSpecialSequences(String, String), generateIndexFiles()

flSort

static boolean flSort
A flag set in analyzeArguments(String[]) and used only inside Sweeper.startMEMBER(Node) to indicate whether or not to sort all the members for each class/subclass.

See Also:
analyzeArguments(String[]), Sweeper.startMEMBER(Node)

flCopyOnly

static boolean flCopyOnly
A flag set in analyzeArguments(String[]) and used once only inside of generateHTMLFiles() to suppress the generation of the VerbNet class pages and the index pages. All the supplemental files, however, are copied and/or constructed.

See Also:
analyzeArguments(String[]), generateHTMLFiles()

flWithCyc

static boolean flWithCyc
A flag set in analyzeArguments(String[]) and used to decide if the VerbNet-Cyc data source should be used and its contents displayed. COMMENT

See Also:
analyzeArguments(String[]), generateHTMLFiles()

xmlFiles

private static File[] xmlFiles
An array of File objects that represent all the XML files in the specified XML input directory. This is loaded up in analyzeArguments(String[]) and referenced in generateHTMLFiles(). If there are no XML files in the XML input directory an exception is thrown and the program exits.

See Also:
analyzeArguments(String[]), generateHTMLFiles()

classesWithSubclasses

static String classesWithSubclasses
A string that holds in a list format all those XML files that contain subclasses. This is used only to show which classes contain subclasses at the bottom of each letter index.

See Also:
Sweeper.startVNSUBCLASS(Node), generateIndexFiles()

totalSubclasses

static int totalSubclasses
A count of all subclasses in VerbNet, at any level (does not include main classes).

See Also:
Sweeper.startVNSUBCLASS(Node), generateIndexFiles()

classHierarchy

static ArrayList classHierarchy
A list of every class and subclass name in Verbnet. This is used to implement the class hierarchy page.

See Also:
Sweeper.curIndentLevel, Sweeper.startVNCLASS(Node), Sweeper.startVNSUBCLASS(Node)

inDir

private static File inDir
The File object that represents the user's desired XML input directory. This is used to gather the XML files, check that a DTD file exists, and show in the starting banner of the program.

See Also:
analyzeArguments(String[]), printStartInfo(), checkDTDFile()

outDir

private static File outDir
The File object that represents the user's desired HTML output directory. This is referenced essentially whenever a method calls createHTMLOutStream(String, String, String), as this method always uses the desired HTML output directory since the program does not output to any other directory for any reason. This is first set in analyzeArguments(String[]), and referenced to create HTML files and copy supplemental files. It is also shown in the starting banner of the program.

See Also:
analyzeArguments(String[]), printStartInfo(), generateHTMLFiles(), generateIndexFiles(), copySupplementalFiles(), createHTMLOutStream(String, String, String)

runTime

private static Calendar runTime
The current date and time of the execution of this program. It is set in main(String[]) and used in replaceSpecialSequences(String, String) to replace @@date@@ and @@time@@ sequences stored in the header and footer files with actual values. See the README file for full list of possible special sequences.

See Also:
main(String[]), replaceSpecialSequences(String, String)

wordLists

static WordLists wordLists
A set of word lists constructed in the Sweeper class and accessed in this class. This set of lists holds these lists: - General Thematic Roles - NP Thematic Roles - Selectional Restrictions - Syntax Restrictions - Predicates

See Also:
Sweeper.startNP(Node), Sweeper.startSELRESTR(Node), Sweeper.startSYNRESTR(Node), Sweeper.startPRED(Node), Sweeper.startTHEMROLE(Node), printReferenceColumn(String, String)

frameLists

static WordLists frameLists
A special word list for the syntactic frame descriptions. This set of lists holds these lists: - Primary Frame Types - Secondary Frame Types

See Also:
Sweeper.startDESCRIPTION(Node), printReferenceColumnSpecial(String)
Constructor Detail

Generator

private Generator()
This constructor is private because the class is not intended to ever be instantiated. The UVI generation is a very procedural process and thus all the members are static.

Method Detail

println

private static void println(String s)
Used as shorthand for System.out.println.

Parameters:
s - the string to print
See Also:
PrintStream.println(String)

print

private static void print(String s)
Used as shorthand for System.out.print.

Parameters:
s - the string to print
See Also:
PrintStream.print(String)

eprintln

private static void eprintln(String s)
Used as shorthand for System.err.println.

Parameters:
s - the string to print
See Also:
PrintStream.println(String)

eprint

private static void eprint(String s)
Used as shorthand for System.err.print.

Parameters:
s - the string to print
See Also:
PrintStream.print(String)

sameSlash

private static String sameSlash(String p)
Ensures that a path only contains the separator character for the given OS on which the program is run. This is only a concern because various paths could be stored in the program in the sNames array. If the system were ported to an OS that contained a different separator character, things could break.

Parameters:
p - the path to check. This will replace all occurrences of both types of separator characters with the current OS's separator character.
Returns:
the corrected string
See Also:
checkSupplementalFiles()

filePath

private static String filePath(File f)
Returns a descriptive path for a File object. This is only an issue due to the possibility of the more desired method, File.getCanonicalPath() to throw an exception. If an exception is thrown, the basic File.getPath() is returned.

Parameters:
f - the file whose path to retrieve
Returns:
a descriptive path

sortXMLFiles

private static void sortXMLFiles()
Sorts the already loaded XML files array xmlFiles. This is because different operating systems will return a directory's contents in different orders but we want to always process the files in a consistent fashion.


main

public static void main(String[] args)
Drives the entire generation process. This is the only public method. All program-ending exceptions are caught here and displayed.

Parameters:
args - Contains the command-line arguments for the program.

printUsage

private static void printUsage()
Prints the usage message. This message includes all available flags. This method can be invoked from main either because the user has specified invalid command-line arguments or because the user has requested to see help for the program. This message is also the 'help' message.

See Also:
main(String[])

printSupplemental

private static void printSupplemental()
Prints the information about the contents of the required supplemental directory. This method is invoked from main if one or more of the required supplemental files were not found. Read more about the significance of each file in the README file.

See Also:
main(String[])

printStartInfo

private static void printStartInfo()
Prints information before the HTML generation process has completed. This method is called from main(String[]). The information printed includes: the desired XML input directory, the desired HTML output directory, supplied flags, and date and time when the program was executed.

See Also:
main(String[])

printEndInfo

private static void printEndInfo()
Prints information after the HTML generation process has completed. As of now this is a single message.

See Also:
main(String[])

analyzeArguments

private static void analyzeArguments(String[] args)
                              throws Generator.InvalidCommandLineArgumentException,
                                     Generator.InvalidDirectoryException,
                                     Generator.UserWantsHelpMessage
Validates all of the command-line arguments and sets appropriate class-level variables.

Parameters:
args - the command-line arguments from main(String[])
Throws:
Generator.InvalidCommandLineArgumentException - if the command-line contains invalid flags or does not contain the two requisite paths.
Generator.InvalidDirectoryException - if the paths requested do not exist or do not have the appropriate permissions.
Generator.UserWantsHelpMessage - if the user has supplied the help flag.
See Also:
existsFlag(String), Generator.MyFilter

existsFlag

private static boolean existsFlag(String flag)
Checks whether the given flag was supplied by the user.

Parameters:
flag - the flag to look for
Returns:
true if the flag exists in the user's supplied command-line arguments.
See Also:
analyzeArguments(String[])

checkDTDFile

private static void checkDTDFile()
Makes sure there is at least one DTD file in the XML input directory. This does not check whether the DTD file found is the one referenced in the XML files, as that check is performed later by the XML parser. This is a fairly weak check in that sense, but here for added safety.

See Also:
main(String[])

checkSupplementalFiles

private static void checkSupplementalFiles()
                                    throws Generator.InvalidSupplementalFilesException
Makes sure all required supplemental files exist. The supplemental directory must exist in the same directory as src/ and uvi/ and must contain the files listed in the help/usage message.

Throws:
Generator.InvalidSupplementalFilesException - if the supplemental directory or any required files therein do not exist or are not readable.
See Also:
main(String[])

readProperties

private static void readProperties()
Reads key-value pairs out of the properties.s supplemental file.


getProperty

public static String getProperty(String propertyName,
                                 String defaultValue)

copySupplementalFiles

private static void copySupplementalFiles()
Copies the supplemental files that belong in the HTML output directory to that directory. These files include the CSS stylesheet, the JavaScript code, and all images. It's important to note that the current implementation of this method does not maintain directory structure of the supplemental files. Each file in the supplemental directory, in a sub-directory or not, will be copied to the same HTML output directory. So if you begin to add additional supplemental files, and have an supplemental/abc.jpg and an supplemental/images/abc.jpg, only one file will appear in the output directory, <html>/abc.jpg, unless this method is changed create subdirectories, etc. (but you can just not give your files identical names).

See Also:
generateHTMLFiles(), copyFile(File, File), createHTMLOutStream(String, String, String)

copyFile

private static void copyFile(File src,
                             File dest)
Performs a low-level copy of one file into another.

Parameters:
src - the source file
dest - the destination file
See Also:
copySupplementalFiles()

createSubdirectories

private static void createSubdirectories()
Creates the two subdirectories that the UVI utilizes for comments and users.

See Also:
generateHTMLFiles()

createSubdirectory

protected static File createSubdirectory(String dirName)

generateHTMLFiles

private static void generateHTMLFiles()
Completes the filling of the HTML output directory of all files, pre-made ones and generated ones. This method and supporting generateOneFile(DocumentBuilder, File) method make use of JDOM to parse the incoming XML files. Essentially this just means that DocumentBuilderFactory, DocumentBuilder, and Document are utilized. After the HTML files for each class are generated, this method reads in PropBank and FrameNet information, adds it to the growing index, and finally generates all the HTML files needed for the index/indices.

See Also:
main(String[]), generateOneFile(DocumentBuilder, File), generateIndexFiles(), addOthers(int)

generateReferencePage

private static void generateReferencePage()
Creates a page that displays the field information collected during the generation phase. Each list is basically just a unique list of all values provided for the given element over all the XML files.

See Also:
generateHTMLFiles()

printReferenceColumn

private static void printReferenceColumn(String title,
                                         String list)
Prints an HTML TD element containing a selected word list. The word lists are constructed during the HTML generation phase (see Sweeper class).

Parameters:
title - the title for the column
list - the word list to display
See Also:
generateReferencePage()

printReferenceColumnSpecial

private static void printReferenceColumnSpecial(String title)
Prints an HTML TD element containing the special word list for the frame descriptions. This special list is constructed during the HTML generation phase (see Sweeper class).

Parameters:
title - the title for the column
See Also:
generateReferencePage()

generateClassHierarchy

private static void generateClassHierarchy()
Creates a page that displays the complete class hierarchy for VerbNet.

See Also:
generateHTMLFiles(), Sweeper.startVNCLASS(Node), Sweeper.startVNSUBCLASS(Node)

compareFirstNumber

private static int compareFirstNumber(String nx,
                                      String ny)
Helps with sorting the class hierarchy.


generateOneFile

private static void generateOneFile(DocumentBuilder db,
                                    File src)
Creates the content of the HTML output file using the source XML file and the Java Document Object Model. The XML file is parsed, and then HTML is sent to the Q class, which was already initialized with the current HTML output stream in generateHTMLFiles(). The XML tags are processed recursively using processNode(Node). All DTD validation errors are printed upon executing the db.parse( src ); statement (via XMLErrorHandler class).

Parameters:
db - the DocumentBuilder which will parse the source XML file into a Document.
src - the source XML file
See Also:
generateHTMLFiles(), processNode(Node)

processNode

private static void processNode(Node n)
This method starts by outputting the HTML code you would want to output upon encountering the start of the given node, then recursively prints all the HTML associated with this node's children nodes, and finally outputs the HTML needed for the close of the given node. The process by which this method outputs the 'start' or 'end' HTML for a given node is subtle. Reflection is used. For a node with tag name NODE, methods called 'startNODE' and 'endNODE' are located in the class called 'Sweeper'. If the method is found, it is executed. If it is not found, nothing happens.

Parameters:
n - the xml node for which to generate HTML code
See Also:
executeHTMLMethod(String, Node), Sweeper

executeHTMLMethod

private static void executeHTMLMethod(String which,
                                      Node n)
Executes a method in the Sweeper class based on a node tag name (i.e. 'VNCLASS') and a 'start' or 'end' flag. Each of the methods in Sweeper, startVNCLASS, endVNCLASS, startMEMBERS, endMEMBERS, etc., produce HTML code. This method just calls the right method based on the current node being processed by processNode(Node).

Parameters:
which - either the value 'start' or 'end', the string to prepend to the tag name when locating the method in Sweeper
n - the node whose tag name should be located in the Sweeper methods
See Also:
Sweeper

addOthers

private static void addOthers(int type)
Reads in data from an alternate data source (one other than VerbNet). Based on the source requested via the argument, a file name is chosen and a its data is extracted into the appropriate internal data structure. Each file has its own format and is accounted for herein.

Parameters:
type - which file to read in and add to the index. This should be one of the DS_* constants.
See Also:
generateIndexFiles(), Index.addLink(String, int, String, String), VN_FN_Map.addMapPair(String, String, String), WordNet

generateIndexFiles

private static void generateIndexFiles()
Creates the main index page and index pages for each letter of the alphabet. The HTML generated is based on the Index class which should contain all links to be displayed. The VerbNet links are added to index in generateOneFile(DocumentBuilder, File) and the PropBank and FrameNet links are added in addOthers(int). This method also generates the searchable index files used by the search mechanism to provide fast search results.

See Also:
generateHTMLFiles(), Sweeper.startMEMBER(Node)

createHTMLOutStream

private static PrintWriter createHTMLOutStream(String fileName)
Creates a new output file and returns an output stream to it. The new file will be initialized with the lines of text from the file header.s. If the overwrite flag is not specified then the file cannot already exist, otherwise the method will fail and return null. This method also replacees all special sequences in the initial file to the appropriate values.

Parameters:
fileName - the name of the file to create and open
Returns:
an output stream associated with the requested file, or null if any error is encountered
See Also:
generateHTMLFiles(), generateIndexFiles(), replaceSpecialSequences(String, String)

createHTMLOutStream

private static PrintWriter createHTMLOutStream(String fileName,
                                               String startWithFile)
Creates a new output file and returns an output stream to it. The new file will be initialized with the lines of text from the file with name startWithFile. If the overwrite flag is not specified then the file cannot already exist, otherwise the method will fail and return null. This method also replacees all special sequences in the initial file to the appropriate values.

Parameters:
fileName - the name of the file to create and open
startWithFile - thhe name of the file which should be loaded into the first file after it is created.
Returns:
an output stream associated with the requested file, or null if any error is encountered
See Also:
copySupplementalFiles(), generateIndexFiles(), replaceSpecialSequences(String, String)

createHTMLOutStream

private static PrintWriter createHTMLOutStream(String fileName,
                                               String startWithFile,
                                               String startWithFile2)
Creates a new output file and returns an output stream to it. The new file will be initialized with the lines of text from the files with names startWithFile and startWithFile2. If the overwrite flag is not specified then the files cannot already exist, otherwise the method will fail and return null. This method also replacees all special sequences in the initial file to the appropriate values.

Parameters:
fileName - the name of the file to create and open
startWithFile - the name of the file which should be loaded into the first file after it is created
startWithFile2 - the name of the second file whose text is to be appended to the newly opened file
Returns:
an output stream associated with the requested file, or null if any error is encountered
See Also:
copySupplementalFiles(), generateIndexFiles(), replaceSpecialSequences(String, String)

closeHTMLOutStream

private static void closeHTMLOutStream(PrintWriter outWriter,
                                       String fileName)
Closes the output stream to a file. The files whose streams are closed with this method are the VerbNet class files, main index file, and letter index files. This method writes the file footer.s to each file before closing it.

Parameters:
outWriter - the output stream to be closed
fileName - the original name of the file to which this output stream was opened. This is required only so replaceSpecialSequences(String, String) will know how to replace the special sequences in footer.s
See Also:
generateHTMLFiles(), generateIndexFiles(), replaceSpecialSequences(String, String)

replaceSpecialSequences

private static String replaceSpecialSequences(String line,
                                              String fileName)
Replaces all special sequences in a given line of text with corresponding real-world values. The available special sequences are: @@browser-title@@, @@page-title@@, @@license@@, @@date@@, and @@time@@. More details about these are supplied in the README file.

Parameters:
line - the line which requires replacement of any existing special sequences
fileName - the name of the file that the line came from. This will be used to determine exactly how to replace certain sequences, since different files will need to display different information around their borders.
See Also:
createHTMLOutStream(String, String, String), closeHTMLOutStream(PrintWriter, String)