You are here: Workspace Basics > Understanding Schema

Understanding Schema

What is a Schema?

模式(有时称为“数据模型”)可以被描述为数据集的结构,或者更准确地,正式定义数据集的结构。

每个数据集都有自己的唯一结构(架构),其中包括要素类型,允许的几何形状,用户定义的属性和其他定义或限制其内容的其他规则。

How Does FME Handle Schemas?

When you create a new workspace, FME reads the input dataset and creates a workspace definition of the schema. Generally it will also create a writer schema, that is, a definition of the structure of the writer. Writer schemas could be called "logical" schemas since they don’t physically exist at that point.

以下是读者和Writer模式,它们出现在Workbench中。源数据位于左侧,目标数据位于右侧。

Each item is a separate feature type. Here, there is one source and one destination feature type, and each feature type has a set of attributes.

新的工作区通常具有相同的源和目标模式;但这并不总是可能 - 特别是当源和目的地格式不同时。在这种情况下,FME将尝试弥补源和目的地模式之间的任何差异。然后可以编辑工作空间,并根据需要更改目标模式;可以添加,删除或重命名,添加,删除或重命名。

FME的实际权力之一是能够在处理期间编辑目标模式和转换数据以匹配。

Viewing the Schema in FME Workbench

A schema is made up of many components. Some of these relate to a dataset as a whole; for example feature types belonging to a dataset are regarded as part of the overall schema and are depicted in the Workbench canvas window.

However, some parts of the schema relate specifically to a single feature type only. Attributes are one such component. These components are shown in the properties dialog of a feature type.

以上:要素类型对话框具有显示信息的许多选项卡。单击“参数”选项卡以查看要素类型名称,要为要素类型的父数据集的名称,允许的几何类型。

以上: The User Attributes tab shows a list of attributes present on the feature type. Each attribute is defined by its name, data type, width, and number of decimal places.

This example shows a reader feature type. (Editing reader feature types is an advanced FME function, suitable mainly for testing purposes.)

You can edit the attributes on a writer (destination) dataset to create the required output.

属性的类型列仅显示与该数据格式的允许类型匹配的值。单击该行以查看属性的允许类型:

Schema Editing

The default schema that FME creates is one suitable for a Quick Translation. When there is a need to customize the output schema, edits can be made using Workbench.

What is Schema Editing?

架构编辑是更改目标架构以自定义输出数据结构的过程。一个很好的例子是重命名输出中的属性字段。

可以编辑什么?

You can edit a number of things, including (but not limited to):

  • 重命名一个属性:Any attribute on the destination schema can be renamed. To rename an attribute open the Feature Type dialog and click the ‘User Attributes tab. Click the attribute to be renamed and enter the new name.
  • Change an Attribute Type:目标模式上的任何属性都可以更改类型,例如将ID从整数转换为浮点数。要更改属性类型,请打开“要素类型”对话框,然后单击“用户属性”选项卡。使用数据类型字段更改属性的类型。
  • Rename a Feature Type:To rename a destination feature type (for example rename roads to updated_roads) open the Feature Type dialog. Click the Parameters tab. Click in the Feature Type name field and edit the name as required.
  • 更改几何类型:要更改要素类型的允许几何图形,例如更改从行到点的允许的几何图形)打开“要素类型”对话框。单击“参数”选项卡。从允许的几何形状列表中选择。该字段将灰色灰色允许任何几何类型。
  • Change a Dataset (Move a Feature Type):当定义多个目标数据集时,可以使用“参数”选项卡下的下拉列表从一个目标数据集从一个目标数据集切换要素类型。

Schema Mapping

Schema Mapping is the means by which a datasets structure can be transformed.

模式映射是什么?

在FME工作台中,工作空间的一侧显示源模式(我们有什么),另一边显示目标模式(我们想要的)。架构映射是以确保正确的源功能将源模式连接到目标架构的过程,该方法将右源功能发送到正确的目标功能类型,并且右源属性将发送到正确的目标属性。

Feature Mapping

Feature mapping is the process of connecting source feature types to destination feature types.

Attribute Mapping

属性映射是将源属性连接到目标属性的过程。

In FME Workbench, feature mapping connections (or links) are shown with a thick, black arrow.

Attributes connections appear as a gray arrow.

In Workbench, attribute mapping is sometimes implied rather than visualized, and no connecting arrow is shown. The color of the port indicates the connection status. Green indicates a connected attribute. Yellow indicates a source attribute unconnected to a destination, and red indicates a destination attribute that is not connected to a source.

Attributes with the same name in source and destination are automatically connected.

In the image above, all of the source attributes are connected to their destination attributes, as indicated by the green ports.

Note:Note:The name is case-sensitive, so ROADS is not the same as roads or Roads.

Schema Mapping in FME Workbench

在大多数情况下,FME自动售货机ically fills in basic schema mapping in a new workspace. The schema mapping can then be edited as required.

In Workbench’s intuitive interface, feature type and attribute connections are made by dragging connecting lines between these parts of the schema.

Feature Mapping in FME Workbench

通过单击源特征类型的输出端口执行功能映射,将箭头拖到目标特征类型的输入端口,然后释放鼠标按钮。

这里,正在通过将箭头从源从源拖到目标来创建来自源到目标特征类型的连接线:

Attribute Mapping in FME Workbench

Attribute Mapping is carried out by clicking on the output port of a source attribute, dragging the arrowhead to the input port of a destination attribute, and releasing the mouse button.

这里,已经建立了功能映射,并且正在进行属性连接。

来自的新联系PERIMETERtoPERIMis being made. The other attributes have matching destinations so they are connected automatically (implied connection). Note the green, yellow, and red color coding showing which attributes have been connected.

See Also