Java Reference
In-Depth Information
5.
throws SQLException {
6.
mCustomerTableName
iCustomerTableName;
7.
mColumnNames
iColumnNames;
8.
mIdentifierColumnName
iIdentifierColumnName;
9.
mOutputTableName
iOutputTableName;
10.
String lSQLQuery
"create table "
mOutputTableName
" as select ";
11.
lSQLQuery
mIdentifierColumnName;
12.
for (Iterator lColNamesIter
mColumnNames.iterator();
13.
lColNamesIter.hasNext();) {
14.
String lColName
(String) lColNamesIter.next();
15.
lSQLQuery
", "
lColName;
16.
}
17.
lSQLQuery
" from "
mCustomerTableName;
18.
Statement lStatement
mJDBCConnection.createStatement();
19.
lStatement.executeQuery(lSQLQuery);
20.
String lSQLCountQuery
" select count(*) from "
mOutputTableName;
21.
Statement lStatementCount
mJDBCConnection.createStatement();
22.
ResultSet lResultSetCount
lStatementCount.
23.
executeQuery(lSQLCountQuery);
24.
lResultSetCount.next();
25.
int lSamplingCount
lResultSetCount.getInt(1);
26.
mCurrentState
CustomerSegmenterState.EXPORTED_FOR_ENHANCEMENT;
27.
report("Count for enhancement: "
lSamplingCount);
28. }
This code generates the SQL statement that creates the desired
table from the
select
statement as shown in lines 10 to 17. The number
of records produced is reported to the user, because it may be linked
with payment to TSB.
Then some time is needed by TSB to enhance the data and return
the enhanced file, which is loaded by the IT team into the OMDB.
This enhanced table is used as the basis for building the clustering
models. As described for this scenario, several clustering models
with different numbers of clusters are built. This is done by the
method called
buildModelAndApply
. Once the clustering models are
built, they are used to assign each customer of the enhanced table
with their cluster identifiers.
In the
buildModelAndApply
method, the parameter
iModelPrefix
is
used together with the number of clusters found in that model to
generate the model names. For example, if the prefix is “MyModel”
and
iMinClusterCount
is set to 5, and
iMaxClusterCount
is set to 7,
then the models “MyModel5,” “MyModel6,” and “MyModel7” will
be built by this routine. The argument
iEnhancedTableName
is the
table name containing demographic and psychographic data filled
by the IT department from the file returned by TSB.
Search WWH ::
Custom Search