我讨论了数据库更新最近,并提到有两个一般情景。

一种方式是当您收到更改日志时 - 要进行更新列表 - 并将其应用于控制数据库。这是一个简单的,因为你提前知道有什么改变,因此需要更新的功能。

第二种更新方式是当您收到一个全新的数据集时,没有指示新的或更改的内容。为此,你需要做改变检测。以前由名称的FME集线器变压器UpdateDetector.常用。但是在2019年我们有一个很好的更新ChangeDetector变压器应该从现在开始使您的转换器...

改变检测:什么是新的?

2018年较早,ChangeTetector变换器与“修订”版本的“原始”数据集进行了比较,并将功能分成添加,删除和不变。

However, what it did不是DO是识别已更改的记录。如果在原始和修改后存在的记录,但其属性的一个属性现在是不同的值,然后将其视为新(添加的)特征。这使得很难执行“upserts”(数据库更新,其中记录已经存在),因为它更加难以判断一个功能是否真正的新功能。

2019年然而,变压器能够处理更新的记录。实际上,新的变压器设计通过更新的输出端口显示了这一点:

So this is very important. It vastly widens the scope of change detection for this transformer.

However, there is the issue of matching original features to their revised counterpart. FME can’t decide a revised record has been updated, without an original record to compare against. This is done using a key attribute value, meaning that the 2019 ChangeDetector has new parameters to handle that:

转换器变压器的差异有助于2019年改变检测

We’ll look at an example shortly. For now just notice that the parameters dialog has a parameter called Update Detection Key Attributes, through which to select an ID or key value.

Anyway, if that functionality sounds familiar, it might be because we already included it in an FME Hub transformer called the UpdateDetector…

替换FME Hub UpdateTetector

创建UpdedetEtector以填补ChangeTetector功能中的空白。通过下载的数量来判断,它是非常流行的变压器。但现在它在FME中心弃用了:

The UpdateDetector transformer was used for Change Detection, but now the ChangeDetector is preferred.

新的Changetetector不仅替换了该集线器变压器,它在功能和性能方面超过它。UpdedetEtector仍将在现有工作区中运行,但我们建议您用新的ChangeTetector替换它。

Now let’s take a look at an example of how the new ChangeDetector works…

ChangeTetector示例

假设我有一个地址数据库:

除此之外,我已经获得了新版本的数据。我现在必须确定哪些地址记录已更改,以便我可以将这些更改推向数据库。我通过简单地为每个数据集添加读者来这样做,并将其传递给ChangeTetector:

2019年FME的变更检测

从那里,我可以看到原始和修订的数据集之间有35条记录,添加了2个新的数据集。还有13个来自原始数据的记录不存在。大多数记录都没有变化。让我们来看看我使用的参数:

  1. GlobalID is the update detection key. This is the attribute that tells FME how to match records in the Original data with records in the revised data.
  2. 所选属性是我检查更改的属性。即,其中两个记录有匹配的GloalId,检查这些属性是否有差异。
  3. 此标志告诉变压器还要检查空间数据集中的几何图形。几个高级参数控制这些精确的检查(见下文)。
  4. 此参数定义一个列表,用于存储发生的更改;例如,哪个属性值不同以及如何。

Just as the parameters are a little different, so can the output be…

新变化检测输出

Because the ChangeDetector transformer now checks for matches – but not necessarily on every attribute – it’s possible that Original and Revised might count as a match, and yet not be totally identical. For example, attributesa,b, 和c是一场比赛,但是dis different. The features are still a match though because you didn’t pickd在所选属性中。

要处理该方案,参数允许您输出匹配功能的 - 或两者:

如果要输出两个功能,则添加匹配ID属性,以便您可以识别将哪些功能视为匹配项。

此外,通过设置列表名称,输出功能记录了原始和修改之间的差异。此记录(例如)有两种差异:

该列表告诉我,使用新值修改了两个属性(Oundernm1和Oundernm2),而此列表:

…tells me that the geometry of the feature was modified.

Also – just as the UpdateDetector did – this transformer sets thefme_db_operation.属性。这是删除记录的示例(是原始的,但不是修改的):

This means that I can simply pass features to a database writer, specify the Feature Operation (fme_db_operation.)和匹配列(这里再次全球化)......

......并且根据需要,自动修改我的地址数据库。

New Tolerance Algorithm

您可能已经注意到一个调用的高级几何参数之一矢量容差:

Despite the name, this is not the same asthe tolerance setting I discussed previously对于FME 2018.为什么这种宽容不同?因为它不是试图找到两行相交的地方,它不是试图调整现有点。相反,它发现两个功能是否在容忍范围内,使用称为的东西Fréchet距离

FRéchet距离是使用两个特征之间的距离导出的两个空间特征的相似性的量度。

常见和更简单的说明是遛狗。说你沿着带上你的狗(皮带)的道路走路。你走进相对直的线(红色线,下面的红线),但你的狗从一侧移动,以便在树上嗅闻(蓝线,b):

带有frechet距离的几何变化检测

问题是,我们每个人都需要多长时间走路各自的路径?在上图中,狗和沃克之间的最宽差距被标记为F。If my dog lead is at leastFlength, then we can walk our respective path without pulling at each other.

This concept makes a great solution for change detection. In FME terms a feature is unchanged if the Fréchet distance between Original and Revised is less than the specified tolerance value.

We feel that this algorithm is an improvement over the past method. It works on more geometries and it also allows applying tolerance in lenient matching mode, which wasn’t possible before.

Fréchet?哪个fréchet?

如果您没有计算几何,请随时跳过此部分。但是,对于您的雀巢鉴赏家距离,你会注意到这是一个真正的弗里什克斯,不是离散Freéchet.(which only calculates distance between vertex points). There is also a弱弗雷什和FME使用当leenient几何匹配参数处于活动状态时:

弱弗雷乔特是当你说助行器或狗被允许回溯他们的步骤。在真正的Fréchet中,每个Fréchet都必须继续前进。

在这个例子中,狗步行者(a)一直以直线行走。狗一开始就直接走路(到b1)但随后在右边的角度(到b2)。它们仍然沿着他们的道路向前移动,但他们的道路处于不同的方向:

在真正的Fréchet中,助行器无法扭转他们的路径以解释这种偏差。他们所能做的最多就是停止他们当前的位置。例如,这里,步行者通过停止在点A1等待时最小化铅长度,而狗遵循其蜿蜒的路径:

也许,比喻突破一点的地方。Upete距离是提前了解路径的计算,而现实生活中是不可能的,知道狗会采取什么课程!

Anyway, in a Weak Fréchet, the walker is allowed to reverse their course. When the dog starts heading from b1 to b2, the walker can double-back to say a2, to make for a shorter Fréchet:

If you don’t understand, you really shouldn’t worry. Just look at the two paths and remember that the Lenient Matching option means two features are more likely to be classed as a match.

更多更改检测信息

上面的例子看了新的改变检测行为。但是,在某些情况下,您可能希望执行旧的ChangeTetector所做的相同添加/删除/不变的过程。即,您不一定需要查找已修改的记录。

如果是这样的话,那么只需将更新检测密钥参数留下空:

然后根据是否是原始或修改的输入,分配您的功能以插入或删除:

和 - 当然 - 如果您没有2019年,那么您仍然可以下载Updededetector。术语“UpdateTetector”现在只显示在WorkBench中作为ChangeTetector的别名;因此,通过FME集线器访问变压器,务必检查界面中弃用的显示选项。

Additionally, theMatcher变压器在2019年获得了一个小的改造。它的参数对话框被刷新并获得了与ChangeTetector相同的公差参数和算法。

概括

所以这就是改变检测的原因。现在您已阅读本文在升级到FME2019时,您将不会感到惊讶地看到完全新的ChangeTetector对话框。

我相信这是一个非常有用的更新,我期待着使用它。哦,如果你在挣扎(!)这是犬点点的答案 - 差异图像:

Happy FMEing,

关于fme. 改变检测 FME Evangelist 空间分析

马克爱尔兰

Mark, aka iMark, is the FME Evangelist (est. 2004) and has a passion for FME Training. He likes being able to help people understand and use technology in new and interesting ways. One of his other passions is football (aka. Soccer). He likes both technology and soccer so much that he wrote an article about the two together! Who would’ve thought? (Answer: iMark)

注释

8回应“Upserts和Dog-Stripping:FME 2019年改变检测有什么新的”

  1. 布鲁斯 说:

    伟大的增强,轻松卖!

  2. yonas b. 说:

    Thanks for the heads up. Refreshing and informative.

  3. n 说:

    伟大的博客帖子标记。喜欢狗散步比喻!

  4. Brilliant improvement and blog post. Thanks Mark, you’re probably one of the few persons who make computational geometry understandable

  5. 安妮 说:

    Where can I find information on how to write the records that come out of the “updated” port? Only the fme_db_operation attributes appear to pass through. Do I have to do this manually with the AttributeManager? Thanks

    • 那很有意思。我看到,如果我的原始数据具有额外的属性,那么它不会出现在更新的端口输出上。我怀疑它是因为我们假设它是一个已删除的属性(即,即改变)即使它未被选中也是如此。如果您想保留它们,那么也许一个特派团将有助于将该信息加入其中。

      我希望这有帮助。如果没有,也许您可​​以将此问题发布给我们的社区论坛.Safe.com,我们可以更好地对话了解可能发亚搏国际在线官网生的事情。亚搏在线

  6. 海登 说:

    我认为这里有一些重要的东西我已经使用这个变换器发出了问题:

    Unless you select “Match selected attributes” as type, the detector even matches on non-exposed attributes. for example, if you are matching two excel files, it will match on the hidden format attribute of excel row number. These hidden attributes are not listed as selectable attributes for matching or excluding from a match. This caused me great confusion until I saw the change list was referencing hidden attributes.

    当您提供列表名称时,它确实创建列表属性,但保持它们隐藏。因此,您必须采取额外的步骤来显示更改探测器TranFormer后的列表更改。

    • 嗯。我看到文件说:

      “匹配所有属性:在所有属性上执行匹配,包括未曝光格式属性。”

      我认为这有点极端,但至少我们知道它正在设计。事实上,其中一个开发商评论说:

      “我们经常有许多属性未公开的情况,或者在运行时未知,因此需要是与未曝光属性匹配的模式。”

      同样,我认为格式属性有点极端,而是合理的。您可以随时尝试BulkattributeMover在执行更改检测之前删除所有格式属性。或者,如果可能的话,仅切换到所选属性。

      我尝试了2020年的列表选项,它确实公开了列表(但不是列表中的每个元素 - 这是无论如何都不会做的)。也许这是一个新的修复,你正在使用旧的fme?或者,如果您无法在更新的功能上看到列表,则可能更好地将此作为对FME社区(知识库中的问题)(知识.Safe.com),其他人可以帮助,我们可以进行正确的对话。亚搏国际在线官网亚搏在线

答复匿名的取消回复

您的电子邮件地址不会被公开。Required fields are marked*

相关的帖子