com.mays.umls
Class Loader

java.lang.Object
  extended by com.mays.umls.Loader

public class Loader
extends Object

Load the UMLS into A Derby db. Needs a resource file that contains the following properties:
data_dir - the directory containing the RRF files
schema - the Derby schema name
derby home - the directory to store the Derby db
mfiles_indexes - a pipe delimited file where each line contains a mrfile and a comma delimited list of columns to index similar to mrfiles format

Sample SnomedLoad.properties file:
data_dir = C:/data/umls/2007AC/META snomed/
schema = umls-snomed
derby_home = c:/ddb
mrfiles_indexes = C:/data/2007AC/META snomed/indexes.txt

Author:
Eric Mays

Constructor Summary
Loader(String config_name)
           
 
Method Summary
 void doCreateTable(String file_name, String[] cols, String mrcols, int row_count)
          Get the column spec from mrcols, create the table and load form the data file.
 void doFiles(String mrfiles, String mrcols)
          Iterate over the lines in mrfiles and create a table for each one.
 void doFilesIndexes(String mrfiles_indexes)
          Iterate of the files in the mrfiles_indexes and create the indexes on the specified columns.
 void doIndexTable(String file_name, String[] cols)
          Actually create the index on the columns
 String getTableName(String file_name)
          Create a table name from the file name.
 void loadTable(String file_name, String table_name, String cols, String vals, com.mays.umls.Loader.ColumnDataType[] types)
          Load the table from the data file using the spec created from mrcols.
static void main(String[] argv)
          Takes a single arg - the name of a resource file in Java properties format.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Loader

public Loader(String config_name)
       throws Exception
Throws:
Exception
Method Detail

doFiles

public void doFiles(String mrfiles,
                    String mrcols)
             throws Exception
Iterate over the lines in mrfiles and create a table for each one. Needs mrcols to get the detailed column specification.

Throws:
Exception

getTableName

public String getTableName(String file_name)
Create a table name from the file name. Note the are subdirs to deal with in addition to stripping the suffix

Parameters:
file_name -
Returns:
table_name

doCreateTable

public void doCreateTable(String file_name,
                          String[] cols,
                          String mrcols,
                          int row_count)
                   throws Exception
Get the column spec from mrcols, create the table and load form the data file. If the file doesn't exist in the directory it isn't loaded. Do a check at the end to see if the table count agrees with the count in mrfiles

Parameters:
file_name -
cols -
mrcols -
row_count -
Throws:
Exception

loadTable

public void loadTable(String file_name,
                      String table_name,
                      String cols,
                      String vals,
                      com.mays.umls.Loader.ColumnDataType[] types)
               throws Exception
Load the table from the data file using the spec created from mrcols.

Parameters:
file_name -
table_name -
cols -
vals -
types -
Throws:
Exception

doFilesIndexes

public void doFilesIndexes(String mrfiles_indexes)
                    throws Exception
Iterate of the files in the mrfiles_indexes and create the indexes on the specified columns. This is in a similar format to mrfiles (but just two cols), so it's easy to copy and edit that file to start

Parameters:
mrfiles_indexes -
Throws:
Exception

doIndexTable

public void doIndexTable(String file_name,
                         String[] cols)
                  throws Exception
Actually create the index on the columns

Parameters:
file_name -
cols -
Throws:
Exception

run

public void run()
         throws Exception
Throws:
Exception

main

public static void main(String[] argv)
Takes a single arg - the name of a resource file in Java properties format. For example, SnomedLoad.properties if the resource file named SnomedLoad.properties is placed in the same directory as this program.
Logs to UmlsLoader.log