Java Reference
In-Depth Information
number of combo boxes in the user interface to propose choices to
the user. Depending on the vendor implementation, more informa-
tion could be obtained, such as descriptive statistics, or simply the
list of categories of the nominal attributes. These operations are per-
formed by the method called createDatasetAndImportMetaData .
Integrators can comment (line 7) if they want to keep the list of
attributes in the retrieved order as provided by the metadata, but it is
sometimes easier to select attributes from a sorted list.
1. private void createDatasetAndImportMetaData(String iDatasetName) {
2.
try {
PhysicalDataSetFactory lPdsFactory
3.
4.
(PhysicalDataSetFactory)mDmeConn.
5.
getFactory("javax.datamining.data.PhysicalDataSet");
mBuildData lPdsFactory.create(iDatasetName, false);
6.
7.
mBuildData.importMetaData();
8.
} catch (JDMException lException) {
9.
throw new UnexpectedJDMException(lException);
10.
}
11. }
After this code is executed, the console member variable mBuild-
Data references a valid PhysicalDataSet object populated with meta-
data information. The following code shows how to retrieve the list
of attribute names from the PhysicalDataSet object.
1. private String[] getAttributeNames() {
2.
int lAttr mBuildData.getAttributeCount();
Vector lAttributesNames new Vector();
3.
for (int i 0; i < lAttr; i ) {
4.
5.
lAttributesNames.add(mBuildData.getAttribute(i).getName());
6.
}
7.
return (String[]) lAttributesNames.toArray(new String[lAttr]);
8. }
The list of attributes is retrieved immediately once the metadata
has been imported. More information could be extracted, such as the
data itself. These attribute names are used in many combo boxes that
are updated through the populateCombos method, as shown here:
1. private void populateCombos(String[] iAttributesNames) {
2.
mTargetNameAttr.setModel(
Search WWH ::




Custom Search