Reader and Writer Keywords

When a reader and writer are created, they scan the mapping file for additional parameters to configure their operation.

All reader and writer parameters are labeled with a two-part keyword. The prefix of the keyword is the current keyword associated with the reader or writer. The suffix identifies the configuration option. The general form of these parameters is:

<ReaderKeyword>_<ReaderOption> <parameter value>
<WriterKeyword>_<WriterOption> <parameter value>

Note: The above examples should appear as a single continuous line.

By default, the <ReaderKeyword> is the same as the READER_TYPE setting, and the <WriterKeyword> is the same as the WRITER_TYPE setting. For example, if the READER_TYPE and WRITER_TYPE are configured as:

READER_TYPE SAIF
WRITER_TYPE SHAPE

then by default the <ReaderKeyword> is SAIF and the <WriterKeyword> is SHAPE. When the SAIF reader is created, it searches the mapping file for parameters prefixed with SAIF_ and the Shape writer searches for parameters prefixed with SHAPE_.

Transformation specifications determine the mapping between source features and destination features. The <ReaderKeyword> starts every source line of a transformation specification and the <WriterKeyword> starts every destination line. In the example above, the transformation module scans the file for pairs of lines starting with SAIF and SHAPE, with the SAIF lines being the source portion of the transformation specification and the SHAPE lines being the destination portion.

The default values for the <ReaderKeyword> and <WriterKeyword> may be overridden by specifying values for READER_KEYWORD and WRITER_KEYWORD in the mapping file or on the command line. The syntax of these directives is:

READER_KEYWORD <newReaderKeyword>
WRITER_KEYWORD <newWriterKeyword>

These directives are used most often when the READER_TYPE and WRITER_TYPE are the same. For example, if FME is to read an Design file, alter the geometry of some of the features, then output a new Design file, a mechanism is needed to identify the source and destination portions of the transformation specifications, as well as the source and destination data sets. The following mapping file fragment shows how to configure FME to do such a translation:

READER_TYPE IGDS
WRITER_TYPE IGDS
WRITER_KEYWORD  I_OUT


# Name the input IGDS file. Note that since no
# <ReaderKeyword> was specified, the default of IGDS
# is used
IGDS_DATASET original.dgn


# Provide the name for the output IGDS file
I_OUT_DATASET newone.dgn


# Identify the seed file for the output IGDS file
I_OUT_SEED_FILE seed.dgn


# Now write a transformation specification. The
# source line will be labeled with the
# <ReaderKeyword> (IGDS), and the destination line
# will be labeled with the <WriterKeyword> (I_OUT)


IGDS 40 igds_color 3 igds_style %s
I_OUT 40 igds_color 4 igds_style %s  \
@Generalize(Douglas,10

When a <ReaderKeyword> or <WriterKeyword> is specified, the reader or writer module first scans the file for its configuration options using this keyword as a prefix. If any of its required options are not found, then the configuration file is rescanned to search for the option prefixed by the default prefix which is the same as the reader or writer type. In the example above, if the line:

I_OUT_SEED_FILE seed.dgn

was given as:

IGDS_SEED_FILE seed.dgn

the end result would be the same. The Design file writer module first scans the mapping file for I_OUT_SEED_FILE, because I_OUT is the <WriterKeyword>. However, it will not find this keyword. It then rescans the file using IGDS as the <WriterKeyword> and finds a value for IGDS_SEED_FILE.