FME Version
Introduction
The first step in any Schema mapping process is to determine the desired output. Decide whether the SchemaMapper will be mapping Feature Types and attributes, or adding new attributes to the destination schema (or a combination of these). Once the structure has been decided, an external lookup table can be created and connected to the SchemaMapper transformer within FME Workbench.
Structure of the Lookup Table
The lookup table can be stored in many different formats, including: comma-separated value files; spreadsheets (Excel or Google); or as tables in a database. Below is an example of a spreadsheet-based lookup table:
Notice that there are two columns and the first row contains headers.
Column Headers: are created by the user and should be named in a meaningful way as they will be referenced within the SchemaMapper transformer. These are also referred to as field names or attribute names.
Table Data: is defined by the source dataset or created by the user (when specifying destination schema). Data can be comprised of attribute names, attribute values and feature type names.
Column Pairs: Notice that the example above contains two columns. Since Schema Mapping is the act of connecting the source schema to the destination schema, there will be pairs of columns in the lookup table that define source and destination schemas within the transformer. For example, the lookup table below contains two columns: a source Feature Type column which is paired with a desired destination Feature Type column.
Another pairing type occurs when you have a source attribute name in one column paired with its attribute value in another. This pairing type is used for filtering and is discussed in parts 3 , 4 and 5 of the SchemaMapper tutorial.
Once the external lookup table has been created, the SchemaMapper transformer can be utilized.
Note: a simple lookup table can be generated from a source dataset which can function as a starting point for the mapping process. For more on this, please see the following article: SchemaMapper: Generating a Lookup Table from Source Data
Setting up the SchemaMapper Transformer
The SchemaMapper transformer has two components, a reader which is used to open the lookup table and an action dialog to define the schema mapping rules. The reader is straightforward and resembles the usual reader for text files or databases.
This image shows the SchemaMapper reading from a lookup table created in a .csv format:
This image shows the reader parameters for this specific lookup table. Notice that column headers are selected from the lookup table which define the source and destination feature types:
Using descriptive column headers will make actions easier to create and the workflow easier to understand.
The action dialog is the second component of the SchemaMapper. This dialog is used to define rules for schema mapping using information stored within the lookup table. Specifically, field names from Line 1 of the lookup table have been recognized and tell the SchemaMapper how to take action.
Once an action is created, it will be displayed in the action dialog. Each SchemaMapper transformer can contain multiple actions. In the example below, the image contains a SchemaMapper which is set up to map both feature types and attributes:
Each subsequent section in this guide will showcase a specific function of the SchemaMapper transformer with an increase in complexity along the way.
Additional Resources
- SchemaMapper: Generating a Lookup Table from Source Data : a guide to generating a simple lookup table using the schema of a source dataset. The resulting table can then be edited for use with the SchemaMapper.
Comments
0 comments
Please sign in to leave a comment.