public class DictionaryToDatabase
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.sql.Connection |
connection
The database connection.
|
protected Dictionary |
dictionary |
protected java.util.Map<java.lang.Integer,long[]> |
idToSynsetOffset
Mapping of database id's to synset offset id's.
|
protected static int |
INTERNAL_ID |
protected java.util.Map<java.lang.Long,java.lang.Integer> |
synsetOffsetToId
Mapping of synset offset id's to database id's.
|
protected static java.lang.String[] |
tables |
protected static long |
TIME |
| Constructor and Description |
|---|
DictionaryToDatabase(Dictionary dictionary,
java.sql.Connection conn)
Create a new DictionaryToDatabase with a database connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createTables(java.lang.String scriptFilePath)
Create the database tables.
|
static void |
importWordnet(java.lang.String propertyFile,
java.lang.String tablesScript,
java.lang.String driverClass,
java.lang.String connectionURL,
java.lang.String username,
java.lang.String password) |
void |
insertData()
Inserts the data into the database.
|
static void |
main(java.lang.String[] args)
Run the program, requires 4 arguments.
|
protected static int |
nextId() |
protected void |
storeExceptions(java.util.Iterator<Exc> itr)
Store the exceptions file.
|
protected void |
storeIndexWords(java.util.Iterator<IndexWord> itr)
Store all the index words.
|
protected void |
storeIndexWordSynsets()
Store the index word synsets.
|
protected void |
storeSynsets(java.util.Iterator<Synset> itr)
Store all of the synsets in the database.
|
protected static int INTERNAL_ID
protected static long TIME
protected static final java.lang.String[] tables
protected final java.sql.Connection connection
protected final java.util.Map<java.lang.Integer,long[]> idToSynsetOffset
protected final java.util.Map<java.lang.Long,java.lang.Integer> synsetOffsetToId
protected final Dictionary dictionary
public DictionaryToDatabase(Dictionary dictionary, java.sql.Connection conn)
dictionary - the dictionaryconn - the database connectionpublic static void main(java.lang.String[] args)
throws JWNLException,
java.sql.SQLException,
java.io.IOException
args - argsJWNLException - JWNLExceptionjava.sql.SQLException - SQLExceptionjava.io.IOException - IOExceptionpublic static void importWordnet(java.lang.String propertyFile,
java.lang.String tablesScript,
java.lang.String driverClass,
java.lang.String connectionURL,
java.lang.String username,
java.lang.String password)
throws java.io.IOException,
JWNLException,
java.sql.SQLException
java.io.IOExceptionJWNLExceptionjava.sql.SQLExceptionprotected static int nextId()
public void createTables(java.lang.String scriptFilePath)
throws java.io.IOException,
java.sql.SQLException
scriptFilePath - - the sql script filenamejava.io.IOException - IOExceptionjava.sql.SQLException - SQLExceptionpublic void insertData()
throws JWNLException,
java.sql.SQLException
JWNLException - JWNLExceptionjava.sql.SQLException - SQLExceptionprotected void storeIndexWords(java.util.Iterator<IndexWord> itr) throws java.sql.SQLException
itr - - the index word iteratorjava.sql.SQLException - SQLExceptionprotected void storeSynsets(java.util.Iterator<Synset> itr) throws java.sql.SQLException, JWNLException
itr - itrjava.sql.SQLException - SQLExceptionJWNLException - JWNLExceptionprotected void storeIndexWordSynsets()
throws java.sql.SQLException
java.sql.SQLException - SQLExceptionprotected void storeExceptions(java.util.Iterator<Exc> itr) throws java.sql.SQLException
itr - iteratorjava.sql.SQLException - SQLException