[an error occurred while processing this directive]

Using Other Database - MySql

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 is detailed as bellows. Users may skip this page if they use the installation script to install their Lexical tools with HSqlDb.

  1. Install Lexical Tools
  2. Database Setup
  3. Load data
  4. Configure in Lexical Tools
  5. Issues


1. Install Lexical Tools

Follow the instructions on Lexical Tools Installation Instructions to complete the installation of lexical tools.

Installation

2. Database Setup

2.1 Requirements

A running database with following specifications is needed to run lexical tools with this option. Please consult to your database administrator 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. Bellows are required information:

We also create the user account and database for lvg:

Create a user account:

Create a database:

2.4 Sample 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 lvg2012, and opened an account with lvg as both username and password.

3. Load Data

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 NameSource Data FileTotal RecordsCreate and Load TableCheck data
Inflection${LVG_DIR}/data/tables/inflection.data1,620,148LoadInflectionCheckInflection
Synonym${LVG_DIR}/data/tables/synonyms.data5,196LoadSynonymCheckSynonym
Acronym${LVG_DIR}/data/tables/acronym.data69,384LoadAcronymCheckAcronym
ProperNoun${LVG_DIR}/data/tables/properNoun.data13,867LoadProperNounCheckProperNoun
Derivation${LVG_DIR}/data/tables/derivation.data89,950LoadDerivationCheckDerivation
Nominalization${LVG_DIR}/data/tables/nominalization.data14,445LoadNominalizationCheckNominalization
Canonical${LVG_DIR}/data/tables/canonical.data1,395,720LoadCanonCheckCanon
Fruitful${LVG_DIR}/data/tables/fruitful.data7,805,672LoadFruitfulCheckFruitful
AntiNorm${LVG_DIR}/data/tables/antiNorm.data2,079,435LoadAntiNormCheckAntiNorm

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 modifying Java codes from either of above two directories.
Both ${LVG_DIR}/loadDb/lib/lvgLoadDb.jar and ${LVG_DIR}/lib/lvg2012dist.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 paragraph describes steps to run java programs 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:

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

Please refer to Configuration setup page for details.

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 bellows:

  1. Method 1:

    or

  2. Method 2:

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:

5. Issues

[an error occurred while processing this directive]