Class DictionaryToDatabase

java.lang.Object
net.didion.jwnl.utilities.DictionaryToDatabase

public class DictionaryToDatabase extends Object
DictionaryToDatabase is used to transfer a WordNet file database into an actual database structure.
  • Field Details

    • LOG

      private static final MessageLog LOG
      Our message log.
    • INTERNAL_ID

      private static int INTERNAL_ID
    • TIME

      private static long TIME
    • connection

      private Connection connection
      The database connection.
    • idToSynsetOffset

      private Map idToSynsetOffset
      Mapping of database id's to synset offset id's. 1 to 1.
    • synsetOffsetToId

      private Map synsetOffsetToId
      Mapping of synset offset id's to database id's. 1:1.
  • Constructor Details

    • DictionaryToDatabase

      public DictionaryToDatabase(Connection conn)
      Create a new DictionaryToDatabase with a database connection. JWNL already initialized.
      Parameters:
      conn - - the database connection
  • Method Details

    • main

      public static void main(String[] args)
      Run the program, requires 4 arguments. See DictionaryToDatabase.txt for more documentation.
      Parameters:
      args -
    • nextId

      private static int nextId()
    • createTables

      public void createTables(String scriptFilePath) throws IOException, SQLException
      Create the database tables.
      Parameters:
      scriptFilePath - - the sql script filename
      Throws:
      IOException
      SQLException
    • insertData

      public void insertData() throws Exception
      Inserts the data into the database. Iterates through the various POS, then stores all the index words, synsets, exceptions of that POS.
      Throws:
      Exception
    • storeIndexWords

      private void storeIndexWords(Iterator itr) throws SQLException
      Store all the index words.
      Parameters:
      itr - - the part of speech iterator
      Throws:
      SQLException
    • storeSynsets

      private void storeSynsets(Iterator itr) throws SQLException
      Store all of the synsets in the database.
      Parameters:
      itr -
      Throws:
      SQLException
    • storeIndexWordSynsets

      private void storeIndexWordSynsets() throws SQLException
      Store the index word synsets.
      Throws:
      SQLException
    • storeExceptions

      private void storeExceptions(Iterator itr) throws SQLException
      Store the exceptions file.
      Parameters:
      itr -
      Throws:
      SQLException