Wizard Advanced Tutorial Step 2

Step 2 - Import categorical state mapping

In the Import session form choose Import mapping -> Descriptor … from the menu. A window as shown below opens that will lead you through the import of the descriptor mapping data. 

The only available import step Descriptor Mapping is already selected at the left side of the window. Now choose the File from where the data should be imported. Open file “Deemy_CHAR.txt”. The chosen encoding ANSI of the file is sufficient. The file column “CharName” contains the descriptor names and file column “CID” the external ID needed for the import of the categorical state mapping import (see below).

In the step table at the right side you find the import step Descriptor Mapping. Click on it and in the center window the assignemt data for the internal “object_id” and the “external_key” are displayed. In column “object_id” click on to make this the decisive column, further click on From file to select the column “CharName” as data source. Now click on the  In column “external_key” click on From file to select the column “CID” as data source. After that the columns should look as shown below.  

Remark: In the import wizards for the import mapping “object_id” allways represents the internal ID of the database. The matching database entry is searched by comparing the label of the database entry to the selected file column. If there are several descriptors (or descriptions) with identical names, the import will generate errors. For categorical states a special handling is available if the state names are not unique.

 

Testing

To test if all requirements for the import are met use the Testing step. You can use a certain line in the file for your test and than click on the Test data in line: button. If there are still unmet requirements, these will be listed in a window. In our example no error occured and the test for the first data line is shown below.

 

Import

With the last step you can start to import the data into the database. If you want to repeat the import with the same settings and data of the same structure, you can save a schema of the current settings (see below).

 

 

Append categorical state mapping

Close the import form for descriptors. In the Import session form choose Import mapping -> Categorical state … from the menu and open file “Deemy_CS.txt” (see below). 

The only available import step CategoricalState Mapping is already selected at the left side of the window. In the step table at the right side you find the import step CategoricalState Mapping, too. Click on it and in the center window the assignemt data for the internal “object_id”, the “parent_key” and the “external_key” are displayed. In column “object_id” click on to make this the decisive column, further click on From file to select the column “CharStateName” as data source. In column “parent_key” you have to specify the parent of the categorical state, i.e. the external descriptor ID. Therefore click on From file to select the column “CID” as data source. In column “external_key” click on From file to select the column “StateID” as data source. After that the columns should look as shown below.  

In the source database of this example not only the categorical states as known in DiversityDescriptions are present, but also some “pseudo states” that represent statistical measures of quantitative descriptors or the data status value “not applicable”. The real categorical states can be recognized by a numeric value in file column “CS”. In any case the import wizard check if a categorical state with the label specified in file column “CharStateName” exists in the database. Therefore let’s do a first test for some selected file lines.

 

Testing

To test if all requirements for the import are met use the Testing step. You can use a certain line in the file for your test and than click on the Test data in line: button. If there are still unmet requirements, these will be listed in a window. Perform the import test for file lines 2, 13 and 12 (see below).

 

The file line 2 refers to parent “CID=1”, which belongs to a text descriptor. The pseudo state “(internal)” was not found as a categorical state in the database, therefore not import is performend for the file line.

 

The file line 13 refers to parent “CID=3”, which belongs to a categorical descriptor. The categorical state “monopodial-pinnate” was found exactly once in the database, therefore the import test was successful.

 

The file line 12 refers to parent “CID=3”, which belongs to a categorical descriptor. But the categorical state “absent” was found 152 time in the database. Therefore it was not possible to find the correct categorical state. But the error message already gives a hint how to solve the problem: To get an unambigious match, additionally the (external) descriptor ID must be specified.

Select the import step CategoricalState Mapping and click on the button at the end of line “object_id”. Select file column “CID”, which contains the reference to the descriptor and enter the separator character | (pipe symbol) in field Pre.: of the new line. Additionally click on button in the first line of “object_id”. In the transformation window insert one replacement (button ): Replace <br> by <br /> . This transformation is neccessary, because the formatting tag “<br>” will be converted to the standardized format “<br /> during export from the original database and import from DELTA. You can check that transformation by the test functions for lines 1860 and 3555. After that the column should look as shown below.

The import test with file line 12 now gives a positive result as shown below..

 

Import

With the last step you can start to import the data into the database. If you want to repeat the import with the same settings and data of the same structure, you can save a schema of the current settings. The imported data lines are marked green (see below).

 

Next: Step 3 - Import of descriptor mapping