This page provides details of how to integrate and configure lexical tools with a pre-existing MySql database. An open source database, MySql, is illustrated as an example. This page can also be used as general guideline for using other database. A step by step guideline are detailed as belows. Users may skip this page if they use the installation script to install their Lexical tools with HSqlDb.
Follow the instructions on Lexical Tools Installation instructions to complete the installation of lexical tools.
2.1 Requirements
A running database along with following information are needed to run lexical tools with this option. Please consult to your database adminstrator if you have questions.
2.2 Procedures
Consult with your DBA if you have any questions
2.3 Example: MySql
MySql is one of the most popular open source databases. We use it as an example for this option. Belows are required information:
We also create the user account and database for lvg:
Create a user account:
Create a database:
2.4 Smaple Script:
You might need your DBA to help you on setting up user account and database for lvg. However, there is a shell script provided with lvg package to ease this step.
Up to this point, users should have installed the MySql database, created a database in it called lvg2009, and opened an account with lvg as both username and password.
3.1 DB tables and data files
There are 9 major tables to be created and loaded into database. Each of the tables below needs to be created and loaded. The directory for these data files is: ${LVG_DIR}/data/tables/*
| Table Name | Source Data File | Total Records | Create and Load Table | Check data |
|---|---|---|---|---|
| Inflection | ${LVG_DIR}/data/tables/inflection.data | 1,318,933 | LoadInflection | CheckInflection |
| Derivation | ${LVG_DIR}/data/tables/derivation.data | 4,559 | LoadDerivation | CheckDerivation |
| Acronym | ${LVG_DIR}/data/tables/acronym.data | 37,512 | LoadAcronym | CheckAcronym |
| Synonym | ${LVG_DIR}/data/tables/synonyms.data | 5,056 | LoadSynonym | CheckSynonym |
| ProperNoun | ${LVG_DIR}/data/tables/properNoun.data | 9,760 | LoadProperNoun | CheckProperNoun |
| Nominalization | ${LVG_DIR}/data/tables/nominalization.data | 14,148 | LoadNominalization | CheckNominalization |
| Canonical | ${LVG_DIR}/data/tables/canonical.data | 1,119,014 | LoadCanon | CheckCanon |
| Fruitful | ${LVG_DIR}/data/tables/fruitful.data | 3,090,425 | LoadFruitful | CheckFruitful |
| AntiNorm | ${LVG_DIR}/data/tables/antiNorm.data | 1,646,925 | LoadAntiNorm | CheckAntiNorm |
Please notes that the last two columns are Java programs used to create DB tables, load data into database, and check loaded table. User may find
source codes for loading and checking data in MySql are under
${LVG_DIR}/loadDb/sources/gov/nih/nlm/nls/lvg/loadDb/MySql.
These Java source codes are derived from what Lvg used for HSqlDb with minor modifications. Java programs of HSqlDB can be found under ${LVG_DIR}/loadDb/sources/gov/nih/nlm/nls/lvg/loadDb/HSqlDb. Users may write their own code for different database by modifing Java codes from either of above two directories.
Both ${LVG_DIR}/loadDb/lib/lvgLoadDb.jar and ${LVG_DIR}/lib/lvg2009dist.jar contain all Java classes for these files.
3.2 Procedures
3.3 Example: MySql
This section describes procedures of loading data into 9 DB tables in MySql database as follows:
This paragram describes steps to run java program of LoadXxx and CheckXxx.
Users may run CheckXxx (similar setup steps as above) to check and perform queries to table Xxx to make sure all tables are created and loaded correctly.
3.4 Sample Scripts
There are two scripts are provided to ease the processes of loading and checking data in the database:
2 3
4. Configure Lexical Tools
4.1 Configuration file
The default configuration file is at ${LVG_DIR}/data/config/lvg.properties. You will need to modify the configuration file to use
4.2 JDBC Driver
Add your JDBC driver to CLASSPATH
4.3 Example: MySql
Use MySql as example, there are two way to set up in the configuration, as described belows:
or
In addition, users need to add JDBC driver to classpath. For examples, add ${LVG_DIR}/lib/jdbcDrivers/MySql/mysql-connector-java-3.1.8-bin.jar to ${LVG_DIR}/bin/norm if you want to run norm.
Now, Lexical Tools are ready to run with MySql database
4.4 JDBC & ports: