eu.bootstrep.newbiolex
Class Process

java.lang.Object
  extended by eu.bootstrep.newbiolex.Process

public class Process
extends java.lang.Object

This class models ETL process. The loading of data from an input file into target tables is an ETL process. The three phases can be summarized as follows:


Field Summary
(package private)  DbMethods DBM
          Instance of DbMethods Class
(package private)  iniETL ETL
          Instance of iniETL Class
(package private)  GeneralMethods GM
          Instance of GeneralMethods Class
(package private)  IOMethods IOM
          Instance of IOMethods Class
(package private)  ListBean LB
          Instance of ListBean object
(package private)  Logger Log
          Instance of Logger Class
(package private)  Platform plat
          Instance of Platform Class
(package private)  TableBean tabBn
          Instance of TableBean object
(package private)  WorkDictionary WD
          Instance of WorkDictionary Class
 
Constructor Summary
Process()
          Void constructor: creates a new instance of Process.
Process(java.lang.String[] args)
          This constructor creates a new instance of the Process class.
 
Method Summary
private  java.lang.Boolean checkForInputFile(PropertyBean PB, MainBean MB, MessageBean mesBn)
          This method reads the property file by executing the readPropFile method.
private  java.lang.Boolean connect2DB(PropertyBean PB, MainBean MB, MessageBean mesBn)
          
This method connects to the database.
private  void disconnectFromDB(MainBean MB)
          This method diconnect the current database connection
private  void loadBL(PropertyBean PB, MessageBean mesBn, MainBean MB, ListBean LB, java.lang.String strRule, java.lang.String strLoad, java.lang.Integer when, java.lang.String alias, java.lang.Boolean clear)
          This method loads data into tables.
private  java.lang.String readProperty(java.io.PrintStream out, java.lang.String propName, java.lang.String propFile, MessageBean mesBn)
          This method reads the property file by executing the readPropFile method.
private  MessageBean setMessageBeans(PropertyBean PB, MainBean MB, MessageBean mesBn)
          This method retrieves messages from the database.
private  java.io.PrintStream setPs()
          This method sets the printstream to the standard output.
private  java.io.PrintStream setPs(java.io.File file)
          This method sets the printstream to the log file encoded in the property file
The method exits if the printstream is not created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Log

Logger Log
Instance of Logger Class


plat

Platform plat
Instance of Platform Class


IOM

IOMethods IOM
Instance of IOMethods Class


DBM

DbMethods DBM
Instance of DbMethods Class


tabBn

TableBean tabBn
Instance of TableBean object


LB

ListBean LB
Instance of ListBean object


GM

GeneralMethods GM
Instance of GeneralMethods Class


WD

WorkDictionary WD
Instance of WorkDictionary Class


ETL

iniETL ETL
Instance of iniETL Class

Constructor Detail

Process

public Process()
Void constructor: creates a new instance of Process. Not used


Process

public Process(java.lang.String[] args)
This constructor creates a new instance of the Process class. The following beans are instantiated:
  • propertyBean. This bean reflects properties defined in the property file.
  • mainBean. This bean contains important features such as connection and so on.
  • messageBean. This bean contains messages for users.

    This methods performs the following steps:

    • step 0 initializes the printstream to standard output
    • step 1 checks the length of the vector args. If the length is four (4), then uses the default property file. Otherwise the default property file is used
    • step 2 retrieves platform related variables such as separator, userDir and so on
    • step 3 reads the property file and sets the propertyBean properties
    • step 4 connects to database
    • step 5 initializes the message bean object
    • step 6 checks whether the input XIF file exists
    • step 7 checks whether the connection is up and the input file exists. If both values are true, then the ETL process can start
    • step 8 no longer used. Output files are written bt the LoadBL method
    • step 9 loads staging tables.
    • step 10 inserts log information into the log table. The log table contains data of the input files, such as number of entries, variants and so on
    • step 11 load target tables of type one (RULE_TGT_<****> in the dictionary).
    • step 12 load sense. This is not a dictionary method. The sql instruction is embedded in the process java method and not automatically created
    • step 13 load special tables. Tables of type two (RULE_SPECIAL_<****> in the dictionary).
    • step 14 load final tables. Tables of type three (RULE_FINAL_<****> in the dictionary).
    • step 15 load preferred tables. Tables of type four (RULE_PREF_<****> in the dictionary). Load data for standard relation.
    • step 16 load preferred tables. Tables of type four (RULE_PREF_<****> in the dictionary). Load data for cluster relation.
    • step 17 load syntax and semantic tables. Tables of type five (RULE_SYNSEM_<****> in the dictionary).
    • step 18 load relatedForm. This is not a dictionary method. The sql instruction is embedded in the process java method and not automatically created
    • .........some other steps not yet implemented................
    • step 26 add inflected form to formrepresentation
    • step 27 add lemmas to formrepresentation Comment this instruction to skip
    • step 28 add lemmas to has_lm_fr Comment this instruction to skip
    • step 29 create BL_BIOSYNSET: this is the first example of mined table
    • step 30 add synonyms to senserelation
    • step 31 disconnect from database.

    Parameters:
    args - The arguments passed from the main method.
  • Method Detail

    loadBL

    private void loadBL(PropertyBean PB,
                        MessageBean mesBn,
                        MainBean MB,
                        ListBean LB,
                        java.lang.String strRule,
                        java.lang.String strLoad,
                        java.lang.Integer when,
                        java.lang.String alias,
                        java.lang.Boolean clear)
    This method loads data into tables. It is executed every time the software needs to load data into any kind of tables: staging, target

    The input parameter when selects the type of tables:

  • 0 -> staging tables. In this case the software loads both standard tables, i.e. tables directly linked to XML elements and correspondence tables, i.e. tables that represent relation between XML elements.
  • 1 -> main target tables, i.e. tables that have to be loaded before any other type of target tables is loaded. For instance the LexicalEntry table belongs to this set.
  • 2 -> special target tables, i.e. tables that need a specific loading subprocess. For instance, the sense and the dev_syncluster tables belong to this set.
  • 3 -> final target tables. This tables are only DEV-like tables. They manage relations and relation data categories defined both at Cluster and Entry level.
  • 4 -> preferred target tables. For preferred tables, the loadBL method is executed twice:
    • ***The alias S loads relations and relation data categories for relations defined at entry level***.
    • ***The alias C loads relations and relation data categories for relations defined at cluster level***.
  • 5 -> Semantic and syntax specific tables.

    If the when parameter is different from 0, this method prepares the target tables to be loaded, by executing two general pourpose methods:

  • ***prepareTargetTables***
  • ***executeSelectTargetTables***

    This method writes down the data files, for each value of the when parameter.

    Parameters:
    PB - The propertyBean
    mesBn - The messageBean
    MB - The mainBean
    LB - The listBean
    strRule - The rule to load data: IGNORE or REPLACE
    strLoad - The load sql instruction
    when - An integer to select which kind of tables have to be loaded
    alias - The alias. Default value is X
    clear - A boolean indicating if the list of tables have to be truncated, before loaded.

  • disconnectFromDB

    private void disconnectFromDB(MainBean MB)
    This method diconnect the current database connection

    Parameters:
    MB - The mainBean. This bean contains the current connection.

    connect2DB

    private java.lang.Boolean connect2DB(PropertyBean PB,
                                         MainBean MB,
                                         MessageBean mesBn)

    This method connects to the database.
    Connection parameters are retrieved from the propertyBean.

    Parameters:
    PB - The propertyBean
    MB - The mainBean
    mesBn - The messageBean
    Returns:
    true if the connection is established

    readProperty

    private java.lang.String readProperty(java.io.PrintStream out,
                                          java.lang.String propName,
                                          java.lang.String propFile,
                                          MessageBean mesBn)
    This method reads the property file by executing the readPropFile method.

    Parameters:
    out - The printStream
    propFile - The property file
    propName - Name of the property
    mesBn - The messageBean
    Returns:
    The value of the property

    setPs

    private java.io.PrintStream setPs()
    This method sets the printstream to the standard output.

    Returns:
    System.out

    setPs

    private java.io.PrintStream setPs(java.io.File file)
    This method sets the printstream to the log file encoded in the property file
    The method exits if the printstream is not created.

    Parameters:
    file - log file
    Returns:
    A print stream defined on log file

    setMessageBeans

    private MessageBean setMessageBeans(PropertyBean PB,
                                        MainBean MB,
                                        MessageBean mesBn)
    This method retrieves messages from the database.
    Messages are stored in the messageBean object

    Parameters:
    PB - The propertyBean
    MB - The mainBean
    mesBn - The messageBean
    Returns:
    The updated messageBean

    checkForInputFile

    private java.lang.Boolean checkForInputFile(PropertyBean PB,
                                                MainBean MB,
                                                MessageBean mesBn)
    This method reads the property file by executing the readPropFile method.

    Parameters:
    PB - The propertyBean
    MB - The mainBean
    mesBn - The messageBean
    Returns:
    The value of the property