To activate a taxonomy, you must link the taxonomy to the
mining field to be used as the item field. You can do this by using
the method DM_setFldTax.
With the method DM_getFldTax, you can identify
the taxonomy that is active for a mining field. You can link only
categorical fields to a taxonomy.
If you remove a taxonomy by using the method DM_remTax,
you also remove the link from the taxonomy to the mining field.
Example
You might have the following tables:
- MYSCHEMA.MY_TAXTABLE
- The table MYSCHEMA.MY_TAXTABLE contains items in the column ITEMCOL and
categories in the column CATMAPCOL_1.
Table 1. MYSCHEMA.MY_TAXTABLEITEMCOL |
CATMAPCOL_1 |
138 |
160 |
139 |
160 |
140 |
161 |
141 |
161 |
- MYSCHEMA.MY_ITEM_NMPTABLE
- The table MYSCHEMA.MY_ITEM_NMPTABLE contains name mappings for
the items in the columns ITEMCOL and ITEMNAME_COL.
Table 2. MYSCHEMA.MY_ITEM_NMPTABLEITEMCOL |
ITEMNAME_COL |
138 |
Beer |
139 |
Wine |
140 |
Mineral water |
141 |
Coke |
- MYSCHEMA.MY_CAT_NMPTABLE
- The table MYSCHEMA.MY_CAT_NMPTABLE contains name mappings for
the categories in the columns CAT_COL and CATNAME_COL.
Table 3. Contents
of the table MYSCHEMA.MY_CAT_NMPTABLECATCOL |
CATNAME_COL |
160 |
Alcoholic drink |
161 |
Non-alcoholic drink |
You might want to define a taxonomy and assign
it to the field
COL1. In the physical data table,
the column that is mapped to
COL1 later when a task
is defined must contain the values 138, 139, 140, and 141 in order
to make the taxonomy effective. The SQL statement looks like this:
IDMMX.DM_LogicalDataSpec()..DM_addDataSpecFld('COL1')
..DM_addTax('MyTax', 'MYSCHEMA.MY_TAXTABLE', 'ITEMCOL',
'CATMAPCOL_1', cast(NULL as VARCHAR), 0)
..DM_setFldTax('COL1','MyTax')
In the taxonomy table
CatMapNmp,
you might want to define a taxonomy and assign it to the field
COL1.
In addition, you might want to define the name mapping
ItemNmp for
the field
COL1 and for the category field
CATMAPCOL_1.
IDMMX.DM_LogicalDataSpec()..DM_addDataSpecFld('COL1')
..DM_addNmp('ItemNmp', 'MYSCHEMA.MYNMPTABLE',
'ITEMCOL', 'MAPPEDITEMCOL')
..DM_addNmp('CatMapNmp', 'MYSCHEMA.MYNMPTABLE',
'VALUECOL','MAPPEDVALUECOL')
..DM_setFldNmp('COL1', 'ItemNmp')
..DM_addTax('MyTax', 'MYSCHEMA.MYTAXTABLE', 'ITEMCOL',
'CATMAPCOL_1', 'CatMapNmp', 0)
..DM_setFldTax('COL1','MyTax')