span8
第4排
Welcome to the FME for Smallworld 5 tutorial.本文介绍如何将数据导入到SmallWorld5数据库中,including how to handle incremental updates to the Smallworld database.
Once information is stored in a database,它的来源不太可能保持不变:会发生变化。This article discusses how you can use FME to undertake incremental updates to your Smallworld database.Keeping the database up-to-date based on changes in the real world.在FME工作台中,这是使用格式属性:fme_db_operation完成的。关于使用fme_db_操作的更多详细信息,请参见本文:更新数据库.
You have used the ‘fme_db_operation' format attribute in the previous文章.FME uses the ‘fme_db_operation' attribute on the Smallworld writer to specify the database operation INSERT,更新,or DELETE for each feature.
当操作是更新或删除时,然后,还必须提供与编写器功能类型上的smallworld“sys_id”匹配的join key属性。FME将使用这个连接键属性自动识别要写入的记录。
When the operation is INSERT,the join key attribute should not be included on the feature.For inserted records,smallworld会自动创建一个内部“sys_id”,如果编写器试图提供联接键,则插入操作可能会失败。
在前一篇文章中,为新客户提供电源点和电缆。These proposed changes have now be Accepted.现在需要一些新连接,也需要更新或删除一些现有连接。This example will update the Smallworld database with these changes to the electrical system.
In this example,您将使用由变更管理系统创建的GML文件。Changes are tracked by the update_type attribute as either D,u,i(删除,update or insert).
1) Inspect Source Dataset
Inspect the source dataset at剑桥电力网更新.gml
Some features have no geometry.所有功能都有一个update_type属性,指示要执行的数据库操作的类型:i(insert),U (Update) & D (Delete).
2)添加smallworld替代方案
In the Smallworld Version Management application,选择替代的FME_更新,或添加此新的替代项(如果尚未存在):
数据集 | Name of Alternative |
电力 | FME_更新 |
3) Generate Workspace
启动FME工作台。On the Start tab,选择生成工作区的选项。
Reader Format: | GML (Geography Markup Language) |
Reader Dataset: | |
Writer Format: | Smallworld 4/5 |
编写器数据集: | localhost:30000 |
Writer Coord.系统: | OSGB-GPS-2015标准 |
参数>服务 | FME |
参数>可选 | | FME_更新 |
选中“导入要素类型定义”复选框。
务必使用符号作为可选的第一个字符
单击“确定”以生成工作区。
4) Specify Feature Types
When the Import Writer Feature Types dialog appears,单击参数按钮。
设置这些参数:
服务:FMENOFACTORY
Table List:
When the GML Select Feature Types dialog appears,选择这些功能类型:
5)工作区整洁
读卡器上的功能类型的顺序可能与编写器上的不同。To make the feature type names easily visible,您可以选择要素类型并调整其大小,or add an annotation can be attached to each feature type.
To add an annotations,选择所有特征类型。Right-click and choose Attach Annotation.
整理工作区,使每个读卡器特征类型与其匹配的写入器特征类型水平对齐;但不要仅仅连接它们。
6)设置数据库操作
Add an AttributeValueMapper transformer connected to a reader feature type.The update_type attribute identifies which type of operation applies to each feature.
源属性: | 更新\类型 |
New Attribute Name: | fme_db_operation |
Source Value: 我 U D |
目标值: |
Right-click on the transformer and use Duplicate to make two copies of the transformer and connect the duplicates to the remaining feature types as shown below:
7)设置几何名称:中心线和位置
在前面的部分中,您设置电缆和电源点的几何图形名称。将几何属性设置器变压器连接到电源点和电缆的属性值管理器,并将几何名称设置为“位置”和“中心线”,分别。
为什么你不需要一个几何属性编辑器来显示“客户”的特征类型?
Note:fme smallworld 5编写器以与smallworld 4完全不同的方式处理smallworld几何。工作区的smallworld 4版本都附在本文的底部以供参考。几何体类型不再显示为属性,也不再使用“宣誓几何体”列表属性。旧的工作区在smallworld 5中仍然兼容。
8) Connect to the Writer Feature Type
将attributeValueMapper或attributeCreator输出端口连接到其关联的写入程序功能类型。
Your workspace will look something like the one below:smallworldex6-完成.fmwt
FME如何使连接到smallworld对象进行更新和删除?FME uses the sys_id (or the equivalent) to make the join to the Smallworld object for the update and delete.In this example this is the id attribute (cable & supply_point) or customer_id (customers).
9) Inspect Output
单击“编写器>重定向到FME数据检查器”以关闭smallworld编写器并将其输出到检查器。
保存工作区,然后运行它。
在FME数据检查员中检查输出。Use the inspection tool to select cables and supply points and then verify their attributes.请注意,对于插件的ID(或客户的客户ID)丢失。This is because it's a new feature and does not yet have a ‘sys_id" created yet.
Here's what's going to happen:
功能类型 | 操作 | Feature Count |
顾客 | 插入 | 4 |
电缆 | 删除 | 三 |
电缆 | 插入 | 7 |
supply_point | 删除 | 三 |
supply_point | 插入 | 三 |
supply_point | 更新 | 1 |
总计: | 21 |
10)写入输出
在FME工作台中,click on Writers > Redirect to FME Data Inspector to direct the output to the Smallworld writer.
暂停:你在给正确的小世界方案写信吗?
运行工作区。
打开“smallworld professional(core)-smallworld core”应用程序。
Use the "Electric Network" bookmark to zoom in to see the area of interest around at Oak Tree Avenue.
Inspect the output in Smallworld.在smallworld版本管理器中双击“fme_updates”,使其成为当前的备选方案。您可能需要刷新GIS视图。
找到插入的电缆和电源点。
Compare the fme_updates alternative to the top to detect the records that were deleted.
Use the object Explorer to locate the "customer" records that were inserted,since without geometry they won't appear in the view.
供应点和使用中间联接表的客户表之间存在关系。smallworld 5编写器无法通过中间联接表创建联接,因此,供应点没有加入到他们的客户中。您必须在Smallworld的GIS对象编辑器中完成这一点。
FME can be used to import objects that have a direct join (parent/child) relationships.这些可以是简单的1:0..n简单连接,1:0..n heterogeneous joins or 1:0..n multiple joins.处理连接在Smallworld FME翻译文档- Translating fields of Smallworld RWOs - Join Fields (you need to obtain the login from GE SupportCentral).You're going to work with join fields in a later article.
The supply points that were inserted have labels,从供应点位置的几何图形导出标签位置。
在smallworld版本管理对话框中,双击“begin”检查点以回滚到原始数据。
回到FME工作台,modify the workspace to add a label geometry to the new supply points.提示:使用偏移变压器。对工作区的更改将类似于上一节,在该节中将标签添加到供应点。
Run the workspace and in Smallworld check that the re-inserted supply points now have new label locations.
FME为smallworld 5编写器创建几何特征的方式存在差异,与小世界4相比。It's quite a lot easier in Smallworld 5.The example below shows how to accomplish this for Smallworld 4.《小世界5》的作者仍然支持这种老方法,所以如果你有现有的工作空间,它们将与smallworld 5兼容,运行时无需任何更改。
?2019安全亚搏在线软件公司|Legal