|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.udo.cs.miningmart.db.DB
edu.udo.cs.miningmart.db.CompilerDatabaseService
public class CompilerDatabaseService
This class extends the class DB to serve as a collection of service and
convenience methods for the M4 compiler.
edu.udo.cs.miningmart.m4.core.utils.DB,
Serialized Form| Field Summary |
|---|
| Fields inherited from class edu.udo.cs.miningmart.db.DB |
|---|
busiDbc, C_BA, C_CONC, c_db, C_FEA, c_input, C_MCF, c_mining, c_no, c_output, C_REL, C_VAL, c_yes, cal, computeAllStat, dirtyObjectSets, m4Dbc, MYSQL, NO_DBMS, ORACLE, ORDER_FOR_WRITING, POSTGRES, READ_ONLY |
| Constructor Summary | |
|---|---|
CompilerDatabaseService(ConfigReader cr,
boolean computeStatistics,
M4InterfaceContext cal)
|
|
CompilerDatabaseService(DB db,
M4InterfaceContext m4i)
|
|
CompilerDatabaseService(java.lang.String m4Url,
java.lang.String m4DbName,
java.lang.String m4User,
java.lang.String m4Passwd,
java.lang.String dataUrl,
java.lang.String dataDbName,
java.lang.String dataUser,
java.lang.String dataPasswd,
boolean computeStatistics,
M4InterfaceContext cal)
Constructor for CompilerDatabaseService. |
|
| Method Summary | |
|---|---|
void |
addFkConstraintToTrash(java.lang.String tableName,
java.lang.String constraintName,
java.lang.String schemaName,
long stepId)
If an operator adds a foreign key constraint to a database table, it must call this method so that this information can be kept. |
void |
addFunctionToTrash(java.lang.String functionName,
java.lang.String schemaName,
long stepId)
If an operator creates a function in the Database, it must call this method so that this information can be kept. |
void |
addIndexToTrash(java.lang.String indexName,
java.lang.String schemaName,
long stepId)
If an operator creates an index in the Database, it must call this method so that this information can be kept. |
void |
addPkConstraintToTrash(java.lang.String tableName,
java.lang.String constraintName,
java.lang.String schemaName,
long stepId)
If an operator adds a primary key constraint to a database table, it must call this method so that this information can be kept. |
void |
addTableToTrash(java.lang.String tableName,
java.lang.String schemaName,
long stepId)
If an operator creates an actual table in the Database, it must call this method so that this information can be kept. |
void |
addViewToTrash(java.lang.String viewName,
java.lang.String schemaName,
long stepId)
If an operator creates an actual view in the Database, it must call this method so that this information can be kept. |
java.lang.String |
computeNumberOfDistinctElements(Column col)
Computes the number of distinct elements present in the column. |
java.lang.String |
computeNumberOfElementsForValue(Column col,
java.lang.String value)
Computes the number of entries in the given column which have the given value. |
java.lang.String |
computeSum(Column col)
Computes the sum of the entries in the given column. |
boolean |
createSQLView(Columnset cs,
Step step)
Overwrites the superclass method to add the created view or table to the trash. |
void |
executeDBProcedure(java.lang.String procedureName,
java.lang.String[] parameters,
boolean businessDb)
This method executes a Stored Procedure in the database. |
DbCore |
getBusinessDbCore()
|
java.lang.String[] |
getCountOfElements(Column col)
This method returns an array of Value objects whose value is a String of the form 'count, element' for each element in the column. |
java.lang.String[] |
getCountOfElements(Column colCA,
Column colTA)
This method returns an array of Value objects whose value is a String of the form 'count, elementTA, elementCA' for each element in the TA and CA column(s). |
java.lang.String[] |
getCountOfElements(Column colCA,
Column colTA,
long sampleSize)
This method returns an array of String objects of the form 'count, elementTA, elementCA' for each element in the TA and CA column(s). |
java.sql.Connection |
getDatabaseConnectionForData()
This method may be needed to provide wrappers with a database connection to the business database. |
java.util.Collection |
getDeviatingValues(Column col,
java.lang.String[] expectedValues)
Compares the distinct values that actually occur in the given column with the values given in the String array. |
java.lang.String[] |
getDistinctElements(Column col)
Return the different values that occur in this column in the database in a String array. |
java.lang.String[] |
getDistinctElements(long columnId)
Return the different values that occur in this column in the database in a String array. |
java.lang.String[] |
getDistinctElementsWithoutNull(Column col)
Return the different non-null values that occur in this column in the database in a String array. |
java.lang.String[][] |
getFrquencyTable(Column theClassAttribute,
Feature[] theAttributes,
java.lang.String[] classValues)
|
java.util.Collection |
getInputConceptsFor(Step step)
This method should only be used by the compiler's control structure. |
java.lang.String |
getSelectStringForColumnDataType(java.lang.String owner,
java.lang.String tableName,
java.lang.String columnName)
This method returns the DBMS-dependent SQL command that returns the name of the datatype of the given column in the given table or view (which is owned by the given owner). |
long |
readCaseIdForStepId(long stepId)
Returns the case id for the given step. |
long |
testSQLColumn(Column col)
This method checks if the generated sql-string for a new column is executable on the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface edu.udo.cs.miningmart.storedProcedures.BusinessDbConnectionSource |
|---|
getNameOfNumericDatatype |
| Constructor Detail |
|---|
public CompilerDatabaseService(java.lang.String m4Url,
java.lang.String m4DbName,
java.lang.String m4User,
java.lang.String m4Passwd,
java.lang.String dataUrl,
java.lang.String dataDbName,
java.lang.String dataUser,
java.lang.String dataPasswd,
boolean computeStatistics,
M4InterfaceContext cal)
throws java.sql.SQLException
m4Url - m4DbName - m4User - m4Passwd - dataUrl - dataDbName - dataUser - dataPasswd - computeStatistics - cal -
java.sql.SQLExceptionDB
public CompilerDatabaseService(ConfigReader cr,
boolean computeStatistics,
M4InterfaceContext cal)
throws java.sql.SQLException
java.sql.SQLExceptionDB
public CompilerDatabaseService(DB db,
M4InterfaceContext m4i)
db - an existing DB connection to copy the
connection data from and to share the cache with.m4i - the M4InterfaceContext to use| Method Detail |
|---|
public boolean createSQLView(Columnset cs,
Step step)
throws M4CompilerError
Columnset - to be testedstep - the step in which this Columnset was created
M4CompilerError
public void addTableToTrash(java.lang.String tableName,
java.lang.String schemaName,
long stepId)
throws M4CompilerError
tableName - Name of the table.schemaName - Name of the db schema in which the table lives.stepId - M4 Id of the step in which the table was created.
M4CompilerError
public void addPkConstraintToTrash(java.lang.String tableName,
java.lang.String constraintName,
java.lang.String schemaName,
long stepId)
throws M4CompilerError
tableName - Name of the altered table.constraintName - Name of the database constraintschemaName - Name of the db schema in which the table lives.stepId - M4 Id of the step in which the table was created.
M4CompilerError
public void addFkConstraintToTrash(java.lang.String tableName,
java.lang.String constraintName,
java.lang.String schemaName,
long stepId)
throws M4CompilerError
tableName - Name of the altered table.constraintName - Name of the database constraintschemaName - Name of the db schema in which the table lives.stepId - M4 Id of the step in which the table was created.
M4CompilerError
public void addFunctionToTrash(java.lang.String functionName,
java.lang.String schemaName,
long stepId)
throws M4CompilerError
functionName - Name of the function.schemaName - Name of the db schema in which the function lives.stepId - M4 Id of the step in which the function was created.
M4CompilerError
public void addIndexToTrash(java.lang.String indexName,
java.lang.String schemaName,
long stepId)
throws M4CompilerError
indexName - Name of the index.schemaName - Name of the db schema in which the index lives.stepId - M4 Id of the step in which the index was created.
M4CompilerError
public void addViewToTrash(java.lang.String viewName,
java.lang.String schemaName,
long stepId)
throws M4CompilerError
viewName - Name of the view.schemaName - Name of the db schema in which the view lives.stepId - M4 Id of the step in which the view was created.
M4CompilerError
public java.sql.Connection getDatabaseConnectionForData()
throws M4CompilerError
getDatabaseConnectionForData in interface BusinessDbConnectionSourcejava.sql.Connection to the business database
M4CompilerError
public long readCaseIdForStepId(long stepId)
throws M4CompilerError
stepId - An M4 step Id.
M4CompilerError
public java.lang.String computeSum(Column col)
throws M4CompilerError
col - the column
M4CompilerError
public java.lang.String computeNumberOfDistinctElements(Column col)
throws M4CompilerError
col - the column
M4CompilerError
public long testSQLColumn(Column col)
throws M4CompilerError
Column - to be tested
M4CompilerError
public java.lang.String[] getCountOfElements(Column col)
throws M4CompilerError
col - The column
M4CompilerError
public java.lang.String[] getCountOfElements(Column colCA,
Column colTA)
throws M4CompilerError
colTA - the target columncolCA - the class column
M4CompilerError
public java.lang.String[] getCountOfElements(Column colCA,
Column colTA,
long sampleSize)
throws DbConnectionClosed,
M4CompilerError
colTA - the target columncolCA - the class columnsampleSize - a maximum sample size
DbConnectionClosed
M4CompilerError
public java.lang.String[][] getFrquencyTable(Column theClassAttribute,
Feature[] theAttributes,
java.lang.String[] classValues)
throws M4CompilerError
M4CompilerError
public java.lang.String computeNumberOfElementsForValue(Column col,
java.lang.String value)
throws M4CompilerError
col - the columnvalue - the value
M4CompilerError
public void executeDBProcedure(java.lang.String procedureName,
java.lang.String[] parameters,
boolean businessDb)
throws M4CompilerError
procedureName - The name of the stored procedure.parameters - The parameters of the stored procedure.
Note that table names and similar parameters should be
quoted like this: 'tablename'. The static method
String quote(String) of this class can be used to
quote such strings.businessDb - true indicates that the
stored procedure is located in the schema of the
business data, false executes a stored
procedure in the M4 schema.
M4CompilerError
public java.lang.String[] getDistinctElements(Column col)
throws M4CompilerError
null. If you want to avoid that, use the
method getDistinctElementsWithoutNull(Column).
col - The Column
M4CompilerError
public java.lang.String[] getDistinctElements(long columnId)
throws M4CompilerError
columnId - The Column id
M4CompilerError
public java.lang.String[] getDistinctElementsWithoutNull(Column col)
throws M4CompilerError
col - The Column
M4CompilerError
public java.util.Collection getDeviatingValues(Column col,
java.lang.String[] expectedValues)
throws M4CompilerError
col - the column, some of whose actual values may be returnedexpectedValues - the values expected in that column
M4CompilerError
public java.util.Collection getInputConceptsFor(Step step)
throws M4Exception
step - a Step to find all input Concepts for
Collection of Concepts
M4Exception
public DbCore getBusinessDbCore()
throws DbConnectionClosed
getBusinessDbCore in class DBDbConnectionClosed
public java.lang.String getSelectStringForColumnDataType(java.lang.String owner,
java.lang.String tableName,
java.lang.String columnName)
getSelectStringForColumnDataType in interface BusinessDbConnectionSourceowner - Name of the owner of the table or viewtableName - Name of a table or view in the business schemacolumnName - Name of the column whose datatype is returned
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||