22
FME Readers and Writers 2013 SP2 Smallworld 4 Reader/Writer This chapter explains how FME reads and writes data to a Smallworld database. Format Notes This format is supported only by the FME Smallworld Edition. This format must only be used with Smallworld FME Translators 4.2.2 and Smallworld 4.2 (or Smallworld 4.2 TSB). You purchase these products separately from GE Energy. The Smallworld interface requires a Smallworld FME Connection Service to be running. Configuring the service is beyond the scope of this document; however, it is described in the GE Energy document Smallworld FME Translators Reference. The GE Energy Smallworld 4 format shipped with FME 2010 and 2011 is supported only for Smallworld sessions based on Smallworld Core Spatial Technology version 4.2. For Smallworld sessions based on Smallworld Core version 3.3, use the GE Smallworld or Smallworld (ACP) format. Overview FME communicates with a Smallworld session through a Smallworld FME connection service controlled by the Smallworld process. To communicate with a Smallworld session, you need to specify: l the name, or IP address, of the computer hosting the Smallworld FME connection service l the TCP port number on which the service is running on that computer l the username and password for accessing the Smallworld database Currently, FME is capable of transferring the following physical, logical, geometrical, and join attribute types to and from Smallworld: l character strings (ds_charci_vec, ds_chari_vec, etc.) l floating point numbers (ds_float, etc.) l integers (ds_int, etc.) l Boolean (ds_bool) l vectors of float (ds_float), integer (ds_int), Boolean (ds_bool) l points l chains, with line, arc, circle, spline, and ellipse sectors l areas l text features l date (ds_date) - 3217 -

FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Embed Size (px)

Citation preview

Page 1: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

Smallworld 4 Reader/Writer

This chapter explains how FME reads and writes data to a Smallworld database.

Format Notes

This format is supported only by the FME Smallworld Edition. This format must onlybe used with Smallworld FME Translators 4.2.2 and Smallworld 4.2 (or Smallworld 4.2TSB). You purchase these products separately from GE Energy.

The Smallworld interface requires a Smallworld FME Connection Service to be running.Configuring the service is beyond the scope of this document; however, it is describedin the GE Energy document Smallworld FME Translators Reference.

The GE Energy Smallworld 4 format shipped with FME 2010 and 2011 is supported onlyfor Smallworld sessions based on Smallworld Core Spatial Technology version 4.2.

For Smallworld sessions based on Smallworld Core version 3.3, use the GE Smallworldor Smallworld (ACP) format.

Overview

FME communicates with a Smallworld session through a Smallworld FME connectionservice controlled by the Smallworld process.

To communicate with a Smallworld session, you need to specify:

l the name, or IP address, of the computer hosting the Smallworld FME connectionservice

l the TCP port number on which the service is running on that computer

l the username and password for accessing the Smallworld database

Currently, FME is capable of transferring the following physical, logical, geometrical,and join attribute types to and from Smallworld:

l character strings (ds_charci_vec, ds_chari_vec, etc.)

l floating point numbers (ds_float, etc.)

l integers (ds_int, etc.)

l Boolean (ds_bool)

l vectors of float (ds_float), integer (ds_int), Boolean (ds_bool)

l points

l chains, with line, arc, circle, spline, and ellipse sectors

l areas

l text features

l date (ds_date)

- 3217 -

Page 2: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

l text joins created for variable length text (defined as text_id)

l join fields created for 1:n or 0:n join relationships

Support for Different Versions of Smallworld

Smallworld 4.2 and Translators Suite 4.2.2

Smallworld Translators Suite 4.2.2, which is compatible with Smallworld 4.2 orSmallworld 4.2 TSB, ships with updated DLL and FMF files for use with FME. Theversion 4.2.2 DLL file is compatible with FME 2010, FME 2011, and FME 2012.

After completing the Smallworld Translators Suite installation, the files are located inthe folder fme422\etc\x86:

l sworldswaf.dll – copy this to the fme installation folder

l sworldswaf.fmf – copy this to the folder fme\metafile

Smallworld 4.2 and Translators Suite 4.2.1

Smallworld Translators Suite 4.2.1 uses the DLL file shipped with Smallworld 4.1. Seebelow for details.

Smallworld 4.1

If you are using Smallworld 4.1, you will have to replace the Smallworld 4 DLL fileswith the following Smallworld 4.1 DLL files located in the default FME Installationdirectory (you can also copy the files fromftp://ftp.safe.com/fme/smallworld/sworld41dll.zip):

l sworldswaf40.dll

l sworldswaf41.dll

l sworldswaf.dll (identical to sworldswaf40.dll)

Smallworld SWAF Quick Facts

About Quick Facts Tables

Format Type Identifier SWORLDSWAFReader/Writer BothLicensing Level FME Smallworld EditionDependencies See Format NotesDataset Type DatabaseFeature Type Class nameTypical File Extensions Not applicableAutomated Translation Support NoUser-Defined Attributes YesCoordinate System Support No

- 3218 -

Page 3: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

Generic Color Support NoSpatial Index NeverSchema Required YesTransaction Support NoGeometry Type sworld_geom_type

Geometry Support

Geometry Supported? Geometry Supported?

aggregate yes point yes

circles yes polygon yes

circular arc yes raster no

donut polygon yes solid no

elliptical arc yes surface no

ellipses yes text yes

line yes z values yes

none yes

Reader Overview

The Smallworld 4 Reader requires no configuration in addition to the standardconfiguration keywords mentioned above. When invoked, the reader will connect tothe Smallworld FME connection service and begin downloading features.

Each feature read from Smallworld will be written in the form described under theheading Feature Representation.

Smallworld 4 Reader Parameters

Database Connection

FME communication with a Smallworld database is controlled by a Smallworld FMEserver. The connection is to a pre-set alternative in the Smallworld database and forthe default Application Configuration File (ACE) – the ACE determines which fields arevisible in FME Workbench. An administrator may have configured the connection torestrict access to specific datasets, tables, and fields.

For details about setting up and starting the Smallworld server, see the GE Energydocument Smallworld FME Translator Reference.

TICS Server Host

The URL of the computer on which the Smallworld FME server is running. For example,if the server is running on the same computer:

- 3219 -

Page 4: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

localhost

The value given here is transferred to the Dataset field in the Add Reader dialog box;for example, as:

localhost:30000

TICS Server Port

The port number on which the Smallworld FME Server listens for FME requests. Forexample:

30000

If left blank, this defaults to 30000. The value given here is transferred to the Datasetfield in the Add Reader dialog box; for example, as:

localhost:30000

Service

This field has a default setting of FME. This is not normally changed.

Username and Password

The Smallworld username of the user requiring access to the Smallworld database.The Smallworld FME server will authenticate the username and password.

The permissions of the given user account will control the datasets and tables to whichyou have access.

Constraints

Table List

Click the Browse button to select the tables to read from. The list of tables includesonly the tables you are authorized to see. If an alternative is specified, then the listincludes only the tables available in that alternative.

The name of each table is prefixed with the dataset name. To filter a long list of tables,enter the first few letters of the table name in the Filter field.

Alternative

The name of the alternative in the Smallworld database to read from (for example,|test), or the default FME alternative if left blank. You cannot read from analternative if there are uncommitted changes.

The data which is read will include all changes made in that alternative.

If reading from multiple datasets, the alternative must exist in each of the datasets.

Reader Directives

The directives that are processed by the Smallworld 4 reader are listed in the sectionsthat follow.

The Reader keyword is SWORLDSWAF_1.

- 3220 -

Page 5: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

ALTERNATIVE

This directive specifies the alternative to read from in the Smallworld database.

The default alternative is used if no value is specified.

Required/Optional

Optional

Values

ALTERNATIVE,|fme_exports

BASELINE_ALTERNATIVE

See EXPORT_CHANGES.

BASELINE_CHECKPOINT

See EXPORT_CHANGES.

CHECKPOINT

The name of the Smallworld checkpoint to read from.

Required/Optional

Optional

EXPORT_CHANGES

Specifies that only the differences between the alternative or checkpoint specified inthe ALTERNATIVE or CHECKPOINT directives and those specified in BASELINE_ALTERNATIVE or BASELINE_CHECKPOINT are read.

For example:

EXPORT_CHANGES,YES,BASELINE_ALTERNATIVE,|fme_exports,BASELINE_CHECKPOINT,0,

Where BASELINE_ALTERNATIVE is the name of the Smallworld alternative to use as thebase for comparison and BASELINE_CHECKPOINT is not used.

Required/Optional

Optional

EXPOSE_INTERNAL_TABLES

Specifies that internal tables as configured by the Smallworld administrator areincluded in the list of tables.

Required/Optional

Optional

- 3221 -

Page 6: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

_MERGE_SCHEMAS

This directive determines the number of feature types to be displayed in Workbench.

Required/Optional

Required

Values

YES specifies that all features types in the Smallworld dataset are merged into onesingle feature type for display in Workbench.

NO specifies that one feature type will be displayed in Workbench for every featuretype in the dataset

PORT

The port number on which the Smallworld FME connection service listens for FMErequests.

If left blank, the port number defaults to 30000.

Required/Optional

Optional

QUERY

Specifies a query for filtering data. Only data from the tables specified in the query isread; however, schema will be created for all the tables specified in the TABLELISTdirective.

For example, this selects records from the Hotel table where Name >= "h":

QUERY,Hotel<lt>space<gt><lt>lf<gt>where<lt>space<gt>Name<lt>space<gt><-lt>gt<gt>=<lt>space<gt><lt>quote<gt>h<lt>quote<gt>

Required/Optional

Optional

SEARCH_ENVELOPE

See USE_SEARCH_ENVELOPE.

SERVER

The URL of the computer on which the Smallworld FME connection service is running.

Required/Optional

Required

SERVICE

The default value for this directive is FME. This is not normally changed.

- 3222 -

Page 7: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

Required/Optional

Required

TABLELIST

This directive specifies the Smallworld database tables to read from, as a space-separated list.

Mapping File Syntax

TABLELIST,<DatasetName>.<TableName><space><DatasetName>.<TableName>

For example:

gis.office<space>gis.office_location<space>gis.office_annotation

Required/Optional

Required

USE_SEARCH_ENVELOPE

This directive specifies whether all features are read or just those that fall inside oroverlap the specified bounds. The directive is set to NO if all features are to be read.

For example:

USE_SEARCH_ENVELOPE,YES,SEARCH_ENVELOPE_MINX,538513443,SEARCH_ENVELOPE_MAXY,253160275, SEARCH_ENVELOPE_MAXX,553176635,SEARCH_ENVELOPE_MINY,265841955

Where:

SEARCH_ENVELOPE_MINX, SEARCH_ENVELOPE_MINY, SEARCH_ENVELOPE_MAXX,

SEARCH_ENVELOPE_MAXY specify the spatial extent of the features to be read.

The values are in the format of the coordinate system set for the Smallworld database,or 0 if the USE_SEARCH_ENVELOPE directive is set to NO.

Required/Optional

Optional

USER_NAME, PASSWORD

Specifies the user account to use when connecting to the Smallworld database.

Required/Optional

Required

Writer Overview

The Smallworld writer must be given the definitions of the Smallworld objects before itmay start writing them out. This is accomplished by importing feature type definitionsfrom the Smallworld database.

- 3223 -

Page 8: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

The attribute types in the object definitions come from the following set:

Attribute Type Description

char(<len>) Character string with a specified maximum length.

Note: Notes:

Use char(255) for join fields.Use char(65535) for Text join fields.

char Character string with a default maximum length (currentlyset to 254). This type should be used only for testingpurposes, and not for production mapping files; for mostcases, use the char(<len>) form above.

float Floating point number.

float(<len>) Vector of floating point numbers, with a length of <len>values. These are represented in FME by a comma-separated list. This list must have exactly <len> values init.If the feature being written has attributes named<attribute name>{0}, <attribute_name>{1}, etc. thenthese values will take precedence over the comma-separated list in <attribute name>.

int Integer

int(<len>) Vector of integers, with a length of <len> values. These arerepresented in FME by a comma-separated list. This listmust have exactly <len> values in it.If the feature being written has attributes named<attribute name>{0}, <attribute_name>{1}, etc. thenthese values will take precedence over the comma-separated list in <attribute name>.

boolean Boolean value, represented by 1 for true or 0 for false.

boolean(<len>) Vector of Booleans, with a length of <len> values. Thesewill be represented in FME by a comma-separated list. Thislist must have exactly <len> values in it.

enum(<enum name>) This is an enumerated attribute. In FME, enumeratedattributes simply contain a string with the symbolic value ofthe enumerated type. An enumerated attribute must containa valid value when being sent to Smallworld.

enum Alternate form of enum(<enum name>) which matches anyenumerated type. The values for these attributes must bevalid for the actual Smallworld attribute to which they map.

- 3224 -

Page 9: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

Attribute Type Description

date Date and time attribute. The value of <attribute name> isin the form year, month, day: YYYYMMDD.If an attribute named <attribute name>.full is definedon the feature, it has the form year, month, day, hour,minute, second—YYYYMMDDhhmmss— and will be usedinstead of <attribute name>.

fme_db_operation The type of operation when writing to a Smallworlddatabase: INSERT, UPDATE, or DELETE.

sworld_point A geometrical attribute defining a point, scale, andorientation or rotation.

sworld_chain A geometrical attribute defined by a series of linear parts orsectors.

sworld_area A geometrical attribute defined by a series of linear parts.The area completely contained by the joined linear parts isthe geometry of the attribute.

sworld_text A text attribute containing a position, a text string, height,justification, and orientation or rotation.

sworld_join_names Dummy attribute used to set the name of the join field(s) inthe feature type. For a single join field, takes the format:

<join name>

For a feature type with multiple join fields, takes theformat:

<feature>.<join name>,<feature>.<join name>

sworld_join_values Dummy attribute used to temporarily hold the unique IDsfrom the source data needed to form the join.

A Smallworld object may contain zero or more geometrical attributes and each ofthese may be defined or may be left unset. The Geometry Representation sectionexplains how FME geometry is mapped onto geometric attributes such as sworld_point, sworld_chain, sworld_text, and sworld_area.

Smallworld 4 Writer Parameters

Database Connection

FME communication with a Smallworld database is controlled by a Smallworld FMEserver. The connection is to a predefined Smallworld database alternative.

An administrator may have configured the connection to restrict access to specificdatasets, tables and fields. For details of setting up and starting the Smallworldserver, see the GE Energy document Smallworld FME Translator Reference.

- 3225 -

Page 10: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

Server Host

The URL of the computer on which the Smallworld FME server is running. For example,if the server is running on the same computer:

localhost

The value given here is transferred to the Dataset field in the Add Writer dialog box;for example, as:

localhost:30000

Server Port

The port number on which the Smallworld FME Server listens for FME requests. Forexample:

30000

If left blank, this defaults to 30000. The value given here is transferred to the Datasetfield in the Add Writer dialog box; for example, as:

localhost:30000

Service

This field has a default setting of FME. This is not normally changed.

Username and Password

The Smallworld username of the user requiring access to the Smallworld database.The Smallworld FME server will authenticate the username and password.

The permissions of the given user account will control the datasets and tables to whichyou have access.

Constraints

Expose Internal Tables

You cannot use this option when configuring a Smallworld 4 Writer.

Table List

Click the Browse button to select the tables to write to. The list of tables includes onlythe tables you are authorized to see. If an alternative is specified, then the list includesonly the tables available in that alternative.

The name of each table is prefixed with the dataset name. To filter a long list of tables,enter the first few letters of the table name in the Filter field.

Alternative

The name of the alternative in the Smallworld database to write to (for example,|test), or the default FME alternative if left blank. You cannot write to an alternative ifthere are uncommitted changes.

If writing to multiple datasets, the alternative must exist in each of the datasets.

- 3226 -

Page 11: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

Checkpoint

The name of the Smallworld checkpoint for the specified alternative. You cannotcontinue if the alternative has uncommitted changes.

If you are writing to multiple datasets, the checkpoint must exist in each dataset. Ifthe checkpoint does not exist in one of the datasets, then set up a separate writer forthat dataset.

WHERE Clause

You can filter the data from specific tables by using a Smallworld query. Only datafrom the tables in the where clause will be written; any other tables specified in theTable List will be ignored.

To enter a query, click the Browse button to display the WHERE Clause dialog box, andthen enter the query either by typing or by pasting a query script that you created inSmallworld. Click OK.

Note You must always precede each table in the query with the dataset name, usingthe format:

[<dataset_name>]<table_name>

For example:

[Gis]Road

where

Name = "Burleigh Street", plus

[Gis]|Pub/Restaurant|

where

count( |Access Roads| ) > 0

If you are unfamiliar with the predicate language, you may prefer to create a DesignView(script) query in Smallworld and then copy the query (taking care to remove anyend-of-line characters (/n) that may be inserted when you paste.

Note: You cannot use a WHERE clause and Export Changes from Baseline.

Export Changes from Baseline

To write data that is just the differences between the current alternative or checkpointspecified in the Constraints area and another alternative or checkpoint, select theExport Changes from Baseline checkbox and then enter the version of the data youwant to use as the baseline.

Note: You cannot use a WHERE clause and Export Changes from Baseline.

Alternative

The name of the Smallworld alternative to use as the base for comparison. The data

- 3227 -

Page 12: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

that is written will be the changes between this alternative and the current alternativeor checkpoint.

Checkpoint

The name of the Smallworld checkpoint to use as the base for comparison. The datathat is written will be the changes between this checkpoint and the current alternativeor checkpoint.

Writer Directives

By default, the <WriterKeyword> for the Smallworld writer is SWORLDSWAF_1.

Feature Representation

Smallworld objects may have more than one geometry, and in fact commonly do.Users may control whether there is a one-to-one correspondence between FMEfeatures and Smallworld objects (the default behavior for the reader), or if there isone FME feature for each geometry attribute within a Smallworld object (the defaultbehavior for the writer). However, users can change the reader to create one FMEfeature for each geometry attribute by passing FME NOFACTORY as a parameter.

When there is a one-to-one correspondence, the feature type of the FME feature is theconcatenation of the dataset name in the Smallworld database and the external namegiven to the Smallworld object definition. Each attribute in the Smallworld object isrepresented by one or, for geometric attributes, several attributes on thecorresponding FME feature. The names of physical attributes in FME are identical tothose in Smallworld. The sections below describe this representation, which is alsoused exclusively by the writer.

The reader is most often used in a mode where there is one FME feature for eachgeometry attribute in the Smallworld object. In those cases, the featurerepresentation is as described below, without the sworld_geometry{<n>} prefix.

FME uses the representations shown in the following table for the values of Smallworldphysical attributes.

Vectors, multiple joins, and dates have special representation in the feature’sattributes and are discussed under the headings Vectors and Multiple Join Attributes ,Foreign Key Attributes and Date and Time Attributes found later in this chapter.Geometric attributes are discussed under the heading Geometry Representation.

Physical AttributeType

Representation (byexamples)

character string “Bourbon Street”

integer 123

float 327.44556

boolean 1

- 3228 -

Page 13: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

Physical AttributeType

Representation (byexamples)

enumerated type “toll_highway”

integer vector 123,345,445,111

float vector 193.03,123.33,123.444

text join “Bourbon Street is a famous andhistoric street that spans thelength of the French Quarter inNew Orleans, Louisiana.”

foreign key field “”

Note: Foreign key fields that arecharacter strings have a 0length; you will need to assign awidth to the attribute.

single join field 7058127

multiple join field 7058127,7058190

date field “19990304”

Vectors and Multiple Join Attributes

Smallworld fields that can contain a collection of values—integer and float vectors—are represented in two forms on the FME feature.

The first is the comma-separated list depicted in the preceding table. For vectors, thistable always contains exactly as many elements as are defined for the vector in thetable’s schema.

The second representation of multiple-value fields is as a list of attributes. Whenreading a vector or multiple join field, the Smallworld reader creates attributes<attrName>{0}, <attrName>{1}, etc. Each <attrName>{n} attribute contains a single elementfrom the comma-separated list. When writing to Smallworld, the writer first looks foran attribute named <attrName>{0} on the feature being written. If this attribute exists,the writer will ignore the contents of the comma-separated value attribute and use thevalues of <attrName>{0}, <attrName>{1}, etc. to define the output field values instead.

Foreign Key Attributes (1:n and 1:n Heterogeneous Joins)

You can write records that have a foreign key relationship provided that you can mapthe join field in the feature type at the child end of the relationship to the join field atthe parent end. The Writer will preserve values in text-based join fields but willoverwrite foreign key values that are automatically generated integers, such as sys_id fields. A workaround is provided for the case where the feature type has a singlesystem-generated ID field of type int.

- 3229 -

Page 14: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

In order to set up the feature types correctly for your Smallworld database, werecommend that you first import the object definitions from the Smallworld database.

See the GE Energy Smallworld FME Translator Reference for an example.

Writing records for the child feature type

Where the feature type is the child end of a foreign key relationship, there is a field forthe parent record ID which forms the join. This field takes the name of the join fieldappended with !fk1. For example, if the join field is placement, then the key field is:

placement!fk1

Where the parent end of this type of join is heterogeneous (that is, may be one ofseveral different object types), then you also need to write the ID of the tablecontaining the parent records—the table ID will be part of the join data. This field takesthe name of the join field appended with !tid. For example:

placement!tid

See the GE Energy Smallworld FME Translator Reference for an example.

Writing records for the parent feature type

The following information only applies when the foreign key relationship relies on asingle system-generated ID of type int (as is the case for the sys_id field type). Youcannot write records that have multiple system-generated integer values.

New records in Smallworld are typically assigned an automatically-generated systemID on insertion, which will be unknown to FME. The following step is thereforenecessary to temporarily hold the ID of each parent record from the source data andthen match it to the join field in the newly inserted parent records in the Smallworlddatabase. To do this you need to set up the following user attributes:

sworld_join_names : use a constant to map this to the name of the Smallworld joinfield in the parent feature type.

sworld_join_values : map this to the field in the source data that holds the parentID, using the format <feature name>.<join field name>. For example, if aSmallworld Park object has foreign key relationships to child objects Seat, Kiosk andGate where placement are the join field names, then you would set sworld_join_names to the following:

seat.placement,kiosk.placement,gate.placement

See the GE Energy Smallworld FME Translator Reference for an example.

Date and Time Attributes

When a date field is read by the Smallworld reader, two attributes are set in the FMEfeature.

The first attribute is simply the name of the attribute, as specified by YYYYMMDD. Thisis compatible with all other FME dates.

- 3230 -

Page 15: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

The second attribute has a suffix of .full and is of the form YYYYMMDDHHMMSS. Itspecifies the date and the time, with the time portion specified using the 24-hour clock.

For example, if a date field called update_time is read, the following attributes will beset in the retrieved FME feature:

update_time =’19980820’update_time.full=’19980820201543’

When writing to Smallworld, the writer looks for both attributes. Either may be in theform of YYYYMMDD or YYYYMMDDHHMMSS. If both attributes are specified, then thevalue specified in update_time.full is used.

Geometry Representation

There are two aspects to the representation of Smallworld geometries within FME:

l the representation of an individual geometric attribute – point, text, chain, or area

l the handling of multiple geometric attributes on a single feature

Multiple Geometric Attributes

Smallworld objects can have very complex geometries associated with them. A singleobject can have any number of geometries of varying geometric types associated withit. To represent this in FME, it is necessary to use aggregates of geometry.

Aggregates contain a list of geometric components. For certain geometric attributetypes – chains and areas – it is also possible for a component of the aggregate to be anaggregate itself. The handling of such structured geometry is discussed below, in thedescription of the representation of chain geometries. In general, however, when afeature has an aggregate geometry, each component of the aggregate relates to asingle geometric attribute.

In order to correlate each component of an aggregate with a particular geometricattribute, additional attribution is given to the FME feature, as follows:

l sworld_geometry{<n>}.sworld_name

Name of corresponding Smallworld geometric attribute for component <n> of theaggregate.

l sworld_geometry{<n>}.sworld_type

Type of corresponding Smallworld attribute for component <n> of aggregate.Legal values are:

sworld_chain, sworld_area, sworld_point, and sworld_text.

The components of the aggregate are numbered starting at 0. Therefore, if an FMEfeature is representing a Smallworld object with two defined geometric attributes, itsgeometry will be an aggregate with two components; each component will be thegeometry for one of the geometric attributes on the Smallworld object. To identify thegeometries to FME, the feature must also contain the following attributes:

sworld_geometry{0}.sworld_name attrName1sworld_geometry{0}.sworld_type geomType1

- 3231 -

Page 16: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

sworld_geometry{1}.sworld_name attrName2sworld_geometry{1}.sworld_type geomType2

The count and ordering of the geometries within the aggregate must match the countand ordering of the sworld_geometry{} attribute lists exactly. There is no ordering ofgeometries implied by attribute naming or position within the SWORLD_DEF lines.

Certain geometric types require additional attributes. These are discussed in depthunder the heading Individual Geometric Attribute Representation. If a particulargeometric attribute requires additional information, it must be provided in an attributewhose name begins with the correct sworld_geometry{} specification.

For example, if the first geometric attribute requires an orientation, the FME featuremust contain an attribute like:

sworld_geometry{0}.sworld_orientation 23.44

In its simplest case, a Smallworld object has only a single geometric attribute or theSmallworld writer supplies only a single geometric attribute to an object. In thesecases, it is possible for the FME feature to contain a single, non-aggregate geometryfor the object. However, there must still be a complete accompanying set of sworld_geometry{0}.xxx attributes defined on the feature.

When reading data from Smallworld, by default FME flattens the geometry into a singlegeometry per feature, based on each geometry attribute in the original Smallworldfeature. Internally, the reader employs the SmallworldGeometryFactory to do thiswork, which simplifies the mapping process for users. In some situations, theaggregate model may be useful, and in those cases, the reader can return anaggregate representation.

The SmallworldGeometryFactory is fully described in the FME Functions and Factoriesmanual.

Individual Geometric Attribute Representation

There are four basic geometric types handled by FME: point, text, chain, and area.Each of these is discussed below. The aggregate referred to in the text below isdescribed in the previous section.

Point Geometries

In addition to the basic (x,y[,z]) location, a Smallworld point has the following attributesdefined:

Attribute Name Meaning Default

sworld_orientation Rotation of the point's symbol,expressed in degrees counter-clockwise.

0.0

sworld_scale Magnification factor of the symbol. 1.0

- 3232 -

Page 17: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

The geometric type for a point is sworld_point. For example, the following FME feature isused in a Smallworld application to represent a fire hydrant whose hose attaches onthe northeast side:

Feature type: hydrant

FME geometry: Aggregate containing one point (123.4,567.8)

Attributes:

l color gold

l street Knowles Ave

l sworld_geometry{0}.sworld_name position

l sworld_geometry{0}.sworld_type sworld_point

l sworld_geometry{0}.sworld_orientation 45.0

l sworld_geometry{0}.sworld_scale 1.0

Text Geometries

Text geometry is commonly used to provide annotation in a Smallworld application. AnFME feature representing annotation has a point geometry and the following geometricattributes:

Attribute Name Meaning Default

sworld_text_string The textual part of the annotation. " "

sworld_text_height The annotation text height scaling factor.The scaling factor of the text height definedin the Smallworld style.

1

sworld_orientation The rotation of the text, in degreescounter-clockwise.

0.0

sworld_vert_just Vertical justification of the text about itslocation point. The value is an integer inthe range 1..5. See the discussion followingthis table for more information.

1

sworld_horiz_just Vertical justification of the text about itslocation point. The value is an integer inthe range 1..5. See the discussion followingthis table for more information.

1

The geometric type for a piece of annotation is sworld_text. Justification of text in aSmallworld application is performed on a five by five grid, with the lower left cornerbeing (1,1), and the upper right corner being (5,5). Each horizontal or verticaljustification value is a discrete position within the grid. The position within the grid isthe location of the text's point geometry with respect to the text string.

- 3233 -

Page 18: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

Chain Geometries

Chains and areas are somewhat more complex than point and text geometries. Thecomplication comes from two aspects of the Smallworld geometries:

l A single chain or area is comprised of one or more sectors, which join togetherend-to-end to make the chain.

l Each sector can be one of four different types: line string, circular arc, circle, orellipse.

The first problem is handled once again by using FME's aggregate geometries. A chainor area's component of the feature's aggregate geometry is itself an aggregate. Thiscan be somewhat confusing, but it is a very powerful and necessary way to representSmallworld data.

For example, suppose a chain is a rope of three sectors: two line strings connected byan arc. This would be represented by an aggregate geometry with three parts:

l the first line string

l a circular arc, whose first point is the same as the last point of the previous linestring

l the second line string, whose first point is the same as the arc's last point

Of course, there must be a way to tell FME how to interpret each sector. Like themultiple geometric attributes, this is handled by FME's list attributes. For this example,there must be three attributes—one for each sector—defined on the FME feature.These attributes are all located below sworld_geometry{X}, just like all other geometricattributes.

If this chain is the second component of an aggregate geometry, the FME feature willcontain the following attributes and values to describe the chain:

Attribute Name Value

sworld_geometry{1}.sworld_sector{0}.sworld_sector_type line

sworld_geometry{1}.sworld_sector{1}.sworld_sector_type arc

sworld_geometry{1}.sworld_sector{2}.sworld_sector_type line

The arc also requires some additional attributes to describe it. These attributes are:

Attribute Name Value

sworld_geometry{1}.sworld_sector{1}.sworld_radius 403.22

sworld_geometry{1}.sworld_sector{1}.sworld_start_angle 32.21

sworld_geometry{1}.sworld_sector{2}.sworld_sweep_angle -47.4

The building of these complex geometries in FME mapping files will require a numberof AggregateFactories. The extraction of geometries will require a number ofDeaggregateFactories.

- 3234 -

Page 19: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

As for the aggregates representing multiple geometric aggregates, it is possible that achain or area can be represented by a single FME line geometry. In this case, thefeature given to the Smallworld writer may contain a simple line geometry rather thanan aggregate containing a single line.

There are six kinds of sectors which may make up a sector rope aggregate for chainand area geometries: line, arc, circle, ellipse, elliptical arc, and spline. The structureof these geometries is described below.

Line Sector

A line is a simple string of (x,y) or (x,y,z) points. A feature containing a chain orarea with a line sector must have the following attribute defined:

sworld_geometry{<m>}.sworld_sector{<n>}.sector_typesworld_line

where <m> is the index of the chain or area geometry, and <n> is the index of the linesector within the geometry.

No additional attributes are required to define a line sector.

Arc Sector

An arc sector represents a portion of a circle. The arc is defined on the FME feature asa point geometry representing the center of the circle to which the arc belongs, with anumber of attributes to describe the arc.

The following attribute is defined on an FME feature containing an arc sector:

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_sector_typesworld_arc

where <m> is the index of the chain or area geometry, and <n> is the index of the linesector within the geometry.

The following attributes are also defined on arc geometries. The attribute names willappear at the same level as the sector type; for example:

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_radius)

Attribute Name Meaning Default

sworld_radius The radius of the circle containing thearc.

none

sworld_start_angle The angle in degrees counter-clockwisefrom due east denoting the position onthe circle of the arc's starting point.

none

sworld_sweep_angle The length of the arc, measured incounter-clockwise arc degrees. Thisnumber may be negative.

none

- 3235 -

Page 20: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

Elliptical Arc Sector

An elliptical arc sector represents a portion of an ellipse. The arc is defined on the FMEfeature as a point geometry representing the center of the circle to which the arcbelongs, with a number of attributes to describe the arc.

The following attribute is defined on an FME feature containing an elliptical arc sector:

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_sector_typesworld_arc

where <m> is the index of the chain or area geometry, and <n> is the index of the linesector within the geometry.

The following attributes are also defined on arc geometries. The attribute names willappear at the same level as the sector type; for example:

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_prim_radius)

Attribute Name Meaning Default

sworld_prim_radius The primary radius of the ellipsecontaining the arc.

none

sworld_sec_radius The secondary radius of the ellipsecontaining the arc.

none

sworld_orientation The orientation of the ellipse's primaryaxis, measured in degrees counter-clockwise from due east.

none

sworld_start_angle The angle in degrees counter-clockwise(measured relative to the orientation ofthe ellipse) denoting the position on thecircle of the ellipse's starting point.

none

sworld_sweep_angle The length of the arc, measured incounter-clockwise arc degrees. Thisnumber may be negative.

none

Circle Sector

A circle sector represents a full circle centered on a specific geographic point. Thecircle is defined in the FME feature as a point geometry representing the center of thecircle, with an additional attribute to specify its radius.

The following attribute is defined on an FME feature containing a circle sector:

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_sector_typesworld_circle

where <m> is the index of the chain or area geometry, and <n> is the index of the linesector within the geometry.

- 3236 -

Page 21: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

FME Readers and Writers 2013 SP2

The following attribute is also defined on circle geometries. The attribute name willappear at the same level as the sector type, in other words,

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_radius)

Attribute Name Meaning Default

sworld_radius The radius of the circle. none

Ellipse Sector

An ellipse sector represents a full ellipse centered on a specific geographic point. Theellipse is defined in the FME feature as a point geometry representing the center of theellipse, with additional attributes to specify its radii and orientation.

The following attribute is defined on an FME feature containing an ellipse sector:

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_sector_typesworld_ellipse

where <m> is the index of the chain or area geometry, and <n> is the index of the linesector within the geometry.

The following attributes are also defined on ellipse geometries. The attribute nameswill appear at the same level as the sector type; for example,

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_prim_radius)

Attribute Name Meaning Default

sworld_prim_radius The primary radius of the ellipse. none

sworld_sec_radius The secondary radius of the ellipse. none

sworld_orientation The orientation of the ellipse's primaryaxis, measured in degrees counter-clockwise from due east.

none

Spline Sector

A spline sector represents Smallworld’s rational b-spline geometry. The spline isdefined in the FME feature as a line string representing the spline’s fit points, and anumber of attributes describing the spline’s control points and other required data.

The following attribute is defined on an FME feature containing a spline sector:

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_sector_typesworld_spline

where <m> is the index of the chain or area geometry, and <n> is the index of the linesector within the geometry.

The following attributes are also defined on spline geometries. The attribute nameswill appear at the same level as the sector type; for example,

sworld_geometry{<m>}.sworld_sector{<n>}.sworld_poly_degree)

- 3237 -

Page 22: FME Readers and Writers 2013 SP2docs.safe.com/fme/2013sp2/pdf/reader_writer_pdf/sworldsw...SmallworldTranslatorsSuite4.2.2,whichiscompatiblewithSmallworld4.2or Smallworld4.2TSB,shipswithupdatedDLLandFMFfilesforusewithFME.The

Smallworld 4 Reader/Writer

Attribute Name Meaning

sworld_poly_degree The degree of the polynomial used to form thespline.

sworld_spline_type The flag that indicates the type of the spline. It isa bit-wise combination of the following values:1. CLOSED2. PERIODIC4. RATIONAL8. PLANAR16. LINEAR

sworld_start_tangent_x

sworld_start_tangent_y

sworld_start_tangent_z

The (x,y,z) coordinate of the point that identifiesthe tangent to the start of the spline.

sworld_end_tangent_x

sworld_end_tangent_y

sworld_end_tangent_z

The (x,y,z) coordinate of the point that identifiesthe tangent to the end of the spline.

sworld_num_knots The number of knots in the spline.

sworld_knots The knots of the spline, as a comma-separatedlist.

sworld_control_x

sworld_control_y

sworld_control_z

Comma-separated lists of the x, y, and z controlpoint coordinates.

sworld_control_weights The control point weights, a comma-separatedlist of the weight values for each control vertex.

- 3238 -