|
||||||||||
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
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 FormField 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, 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 |
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 |
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.lang.String |
getDbNameOfM4Datatype(java.lang.String m4RelDatatypeName,
int length,
boolean useBusinessDBMS)
This method returns the DBMS-dependent name of the datatype which the current DBMS uses to realize the given M4-Relational Datatype. |
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 |
getNameOfNumericDatatype()
Returns the name that the underlying DBMS uses for numeric datatypes. |
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). |
java.lang.String |
getUniqueRowIdentifier(boolean useBusinessDBMS)
Return the DBMS-dependent string which can be used in a SELECT-Statement in SQL to uniquely identify table rows by an integer. |
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 |
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.SQLException
DB
public CompilerDatabaseService(ConfigReader cr, boolean computeStatistics, M4InterfaceContext cal) throws java.sql.SQLException
DB
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 useMethod Detail |
public boolean createSQLView(Columnset cs, Step step) throws M4CompilerError
step
- 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 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 BusinessDbConnectionSource
java.sql.Connection
to the business database
M4CompilerError
public java.lang.String getUniqueRowIdentifier(boolean useBusinessDBMS) throws M4CompilerError
useBusinessDBMS
- Set this parameter to TRUE if the unique row identifier will be used
in the business data schema. (This is probably the case.) Set it to FALSE if the
identifier will be used in the M4 data schema.
M4CompilerError
public java.lang.String getDbNameOfM4Datatype(java.lang.String m4RelDatatypeName, int length, boolean useBusinessDBMS) throws M4CompilerError
m4RelDatatypeName
- name of the M4 Relational Datatypelength
- Gives a size for the datatype. For example, if the M4 Relational Datatype
is NUMBER and length is 10, then the return value will be the String "NUMBER(10)"
if the DBMS is Oracle. If this length is not positive, the datatype will be returned without
a size, in the example: "NUMBER" The DBMS may not allow lengths at all, in which case
also the datatype without a size is returned.useBusinessDBMS
- Set this parameter to TRUE if the datatype should be looked up
in the DB that holds the business data schema. Set it to FALSE if it should
be looked up in the M4 schema DB.
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
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 getInputConceptsFor(Step step) throws M4Exception
step
- a Step
to find all input Concepts for
Collection
of Concept
s
M4Exception
public DbCore getBusinessDbCore() throws DbConnectionClosed
getBusinessDbCore
in class DB
DbConnectionClosed
public java.lang.String getSelectStringForColumnDataType(java.lang.String owner, java.lang.String tableName, java.lang.String columnName)
getSelectStringForColumnDataType
in interface BusinessDbConnectionSource
owner
- 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
public java.lang.String getNameOfNumericDatatype()
BusinessDbConnectionSource
getNameOfNumericDatatype
in interface BusinessDbConnectionSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |