textclassifier.database
Class OstraDBLoaderBC

java.lang.Object
  extended by textclassifier.database.OstraDBLoaderBC
All Implemented Interfaces:
documentConnecterBC

public class OstraDBLoaderBC
extends java.lang.Object
implements documentConnecterBC

Provides important informations about content of a relational table.


Constructor Summary
OstraDBLoaderBC(java.lang.String c, java.lang.String t, java.util.ArrayList<java.lang.String> atts, java.util.ArrayList<java.lang.String> discatts)
          Constructor of the class
 
Method Summary
 java.lang.String getAttributes()
          Returns SQL command that gets all attributes names - sql command returns only one column - attribute name!
 java.lang.String getCategories()
          Returns the query necessary to get all categories from the table (distinct values of target column)
 java.lang.String getDistinctValues(java.lang.String att)
          Returns SQL command that returns all distinct values of specified attribute
 java.lang.String getSqlQueryGetCategoriesAndCountsOfItemset(largeItemset oneItemset, Category cat)
          Returns SQL command that returns the count of transactions of transactions for one specified frequent itemset and one category
 java.lang.String getSqlQueryGetFromDiscInterval(DiscInterval disc, Category cat, java.lang.String att_name)
          Returns SQL command for the count of transactions, values of which correspond to the specified interval and category
 java.lang.String getSqlQueryGetValuesAndCountsOfAttribute(java.lang.String attribute, int totalTransCount, Category cat)
          Returns SQL command that returns all possible values of specified attribute in a specified category with a secified number of occurences
 java.lang.String getTableName()
          Returns the name of the input relational table
 java.lang.String getTransInCategory(Category cat)
          Returns SQL command that returns total count of transactions with specified category
 java.lang.String hasHigherSupportThanMinsupp(java.lang.String condition, double min_supp, Category cat)
          Returns SQL command that returns count of transactions of a specified category and condition (for example condition for minimum support)
 java.lang.String inCategories(largeItemset oneItemset)
          Returns SQL command that returns the count of categories that satisfy the condition specified by a frequent itemset
 java.lang.String inCategories2(largeItemset oneItemset)
          Returns SQL command that returns the names and counts of categories that satisfy the condition specified by a frequent itemset
 boolean isDiscretizableAttribute(java.lang.String att_name)
          Returns true, if the specified attribute must be discretized
 boolean isTarget(java.lang.String att_name)
          Returns true, if the specified attribute must be discretized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OstraDBLoaderBC

public OstraDBLoaderBC(java.lang.String c,
                       java.lang.String t,
                       java.util.ArrayList<java.lang.String> atts,
                       java.util.ArrayList<java.lang.String> discatts)
Constructor of the class

Parameters:
c - name of the target column for classification
t - name of the input relational table
atts - list of all input columns usedd for classification
discatts - list of all input attributes, which sholud be discretized (subset of in_atts)
Method Detail

getTableName

public java.lang.String getTableName()
Returns the name of the input relational table

Specified by:
getTableName in interface documentConnecterBC
Returns:
string with the name of the table

getCategories

public java.lang.String getCategories()
Returns the query necessary to get all categories from the table (distinct values of target column)

Specified by:
getCategories in interface documentConnecterBC
Returns:
string the SQL query

getAttributes

public java.lang.String getAttributes()
Returns SQL command that gets all attributes names - sql command returns only one column - attribute name!

Specified by:
getAttributes in interface documentConnecterBC
Returns:
zatim nefunguje

getTransInCategory

public java.lang.String getTransInCategory(Category cat)
Returns SQL command that returns total count of transactions with specified category

Specified by:
getTransInCategory in interface documentConnecterBC
Parameters:
cat - a category (a value of target column)
Returns:
string the SQL query

hasHigherSupportThanMinsupp

public java.lang.String hasHigherSupportThanMinsupp(java.lang.String condition,
                                                    double min_supp,
                                                    Category cat)
Returns SQL command that returns count of transactions of a specified category and condition (for example condition for minimum support)

Specified by:
hasHigherSupportThanMinsupp in interface documentConnecterBC
Parameters:
condition - a condition, which a transaction must satisfy
min_supp - minimum support threshold
cat - a category (a value of target column)
Returns:
string the SQL query

getSqlQueryGetValuesAndCountsOfAttribute

public java.lang.String getSqlQueryGetValuesAndCountsOfAttribute(java.lang.String attribute,
                                                                 int totalTransCount,
                                                                 Category cat)
Returns SQL command that returns all possible values of specified attribute in a specified category with a secified number of occurences

Specified by:
getSqlQueryGetValuesAndCountsOfAttribute in interface documentConnecterBC
Parameters:
attribute - the name of an attribute
totalTransCount - required count of occurences of a value
cat - a category (value of target attribute)
Returns:
string the SQL query

getSqlQueryGetCategoriesAndCountsOfItemset

public java.lang.String getSqlQueryGetCategoriesAndCountsOfItemset(largeItemset oneItemset,
                                                                   Category cat)
Returns SQL command that returns the count of transactions of transactions for one specified frequent itemset and one category

Specified by:
getSqlQueryGetCategoriesAndCountsOfItemset in interface documentConnecterBC
Parameters:
oneItemset - frequent itemset, for which we need to know its transaction
cat - a category (value of target attribute)
Returns:
string the SQL query

getSqlQueryGetFromDiscInterval

public java.lang.String getSqlQueryGetFromDiscInterval(DiscInterval disc,
                                                       Category cat,
                                                       java.lang.String att_name)
Returns SQL command for the count of transactions, values of which correspond to the specified interval and category

Specified by:
getSqlQueryGetFromDiscInterval in interface documentConnecterBC
Parameters:
disc - an interval obtained by discretization
cat - a category (value of target attribute)
att_name - a name of attribute, for which the interval was created
Returns:
string the SQL query

inCategories

public java.lang.String inCategories(largeItemset oneItemset)
Returns SQL command that returns the count of categories that satisfy the condition specified by a frequent itemset

Specified by:
inCategories in interface documentConnecterBC
Parameters:
oneItemset - a frequent itemset
Returns:
string the SQL query

inCategories2

public java.lang.String inCategories2(largeItemset oneItemset)
Returns SQL command that returns the names and counts of categories that satisfy the condition specified by a frequent itemset

Specified by:
inCategories2 in interface documentConnecterBC
Parameters:
oneItemset - a frequent itemset
Returns:
string the SQL query

getDistinctValues

public java.lang.String getDistinctValues(java.lang.String att)
Returns SQL command that returns all distinct values of specified attribute

Specified by:
getDistinctValues in interface documentConnecterBC
Parameters:
att - the name of the attribute
Returns:
string containing the query

isTarget

public boolean isTarget(java.lang.String att_name)
Returns true, if the specified attribute must be discretized

Specified by:
isTarget in interface documentConnecterBC
Parameters:
att_name - the name of the attribute
Returns:
boolean value depending on the attribute

isDiscretizableAttribute

public boolean isDiscretizableAttribute(java.lang.String att_name)
Returns true, if the specified attribute must be discretized

Specified by:
isDiscretizableAttribute in interface documentConnecterBC
Parameters:
att_name - the name of the attribute
Returns:
boolean value depending on the type of attribute