斯潘8
span4
动态工作区是指不是从标准工作区定义中获取编写器架构的工作区,但是来自现有数据集的模式或用列表属性构造的模式。
In most cases the writer schema is obtained from a single source,但是,有时需要从多个源构建单个编写器模式。
此示例使用使用列表属性构造编写器模式的技术,但是使用多个来源来获取这样做所需的信息。It is a way to be able to merge different datasets together and write them out with a combined schema - all in a dynamic way.
Specifically,here the workspace translates a dataset of parks.Attributes from a secondary dataset need to be added to the parks and written out.因为这些属性事先不知道,有必要使用动态翻译;and because there are multiple schema sources a technique that uses list attributes must be used.
如前一篇文章所述,构建动态模式所需的列表属性为attribute。name和attribute。fme data _type-这两个列表属性定义了编写器模式属性的名称和数据类型。
以及从零开始建造,these can be extracted directly from our main dataset using a reader format called "Schema (Any Format)",for example:
Attribute | Value |
attribute{0}.fme_data_type |
FMETIN 16 |
属性0.name |
帕尔奇 |
attribute{1}.fme_data_type |
FMETIN 16 |
属性1.name |
RefParkId |
属性2.fme _数据类型 |
FMEI VARCHARAR(40) |
属性2.name |
别名 |
Similarly a list of attributes can be extracted from the secondary data source:
Attribute | Value |
attribute{0}.fme_data_type | FMEI VARCHARAR(30) |
属性0.name | ZoneName |
attribute{1}.fme_data_type | FMEI VARCHARAR(30) |
属性1.name | 地带性 |
工作区要解决的主要问题是将这两个列表合并到一个输出模式定义中。
工作区如下所示:
有三个读者:
模式读取器从源数据集(主数据集和辅助数据集)读取模式,因此发出两个特性。属性列表被分解为每个属性创建一个特征,然后使用聚合转换器将其合并回一个列表。Excess schema information is removed with an AttributeKeeper transformer:
The primary and secondary datasets are read - the primary dataset here is fixed,但是辅助数据集是通用的/动态的-并且信息从辅助数据集传输到主数据集(这里使用空间过滤器):
Finally the schema list attributes are merged onto the primary features using the FeatureMerger transformer:
编写器功能类型是动态设置的,并将架构功能用作架构源。
运行工作区并检查输出。你会发现每个公园现在都有关于公园所在开发区的信息。
The important part is that you can change the source zoning dataset to something else (of any format) and the attributes from those features will be dynamically attached and used in the output.
1。Add Readers and Schema
Add two MITAB Readers,one for Zones data and one for Parks data,ensure that Single Merged Feature Type is selected for both.Then add a schema Reader.For the Schema Reader,add the Zones.tab file first and then click on the parameters.在要公开的其他属性的参数中,添加以下列表。Then click ok to add the reader to the workspace.在导航器窗口中,最大化区域[模式]并单击源数据集。单击下拉列表,然后单击选择多个文件/文件夹。添加parks.tab文件。
2。Set up SpatialFilter
Connect a SpatialFilter to the Zones Writer via the Filter Input port and the Parks Writer via the Candidate Input port.在参数中,设置要测试的空间谓词:
三。列表爆炸器
Add a ListExploder to the Schema Writer.在参数中,将列表属性设置为属性。
4。Aggregator
Connect an Aggregator to the Elements Output port on the ListExploder.将累积模式设置为合并传入属性。检查生成列表,将“列表名称”设置为“属性”,并为选定的属性添加“FME数据”类型和名称。
注:旧版本的FME没有“添加到列表”或“选择属性”参数。如果打开附加的模板,它也缺少参数,因为工作区是用旧版本创建的。我将离开模板,以便使用旧的FME的用户仍然可以使用它;but to get these parameters simply right-click and choose Upgrade Transformer.
5.AttributeKeeper
We are only interested in keeping two of the attributes that we exposed.在聚合器后添加attributekeeper。In the parameters select the … in Lists to Keep and select attribute{}.fme_data_type and attribute{}.name
6。特征合并
为了将所有东西合并在一起,我们将使用功能合并。Connect both the Passed and Failed Output ports on the SpatialFilter to the Requestor Input port and the AttributeKeepers Output port to the Supplier Input port on the FeatureMerger.In the FeatureMerger parameters,将请求者设置为3,供应商设置为3,keep everything else as the defaults.
7。写入动态写入程序
Add a MITAB Writer to the workspace,确保将其设置为动态(高级)。将其连接到FeatureMerger上的合并输出端口。Once added to the workspace,在参数中,将模式源设置为“来自模式功能的模式”。Connect an Inspector to the Merged Output port and run translation.
Dynamic 亚搏在线Workflows: Destination Schema is Derived from a Lookup Table
Dynamic 亚搏在线Workflows: Basics of Dynamics
Dynamic 亚搏在线Workflows: Destination Schema as a Mirror Image of the Source Dataset
Dynamic 亚搏在线Workflows: Destination Schema is Derived from a Schema Feature
© 2019 亚搏在线Safe Software Inc |合法的