Skip to main content
Question

Matcher - how do attributes get merged in SingleMatched output port?

  • December 21, 2016
  • 6 replies
  • 125 views

tim_wood
Contributor
Forum|alt.badge.img+8

When using Matcher, "A single copy of each set of matched features is sent to the SingleMatched port. The attributes on these features will be merged onto the single output feature."

How do attributes get merged (which ones are kept and which lost), and what happens to geometry?

With FeatureMerger, you choose which source attributes are output, so you know what you're going to get.

This is based on sending 2 source datasets (old and new) to Matcher for comparison on an ID field. Should Matcher only be used on a single dataset?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • December 21, 2016

The attributes on the single Matched output port will be accumulated in a list, with the name of the list provided as in the image:


tim_wood
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • December 22, 2016

The attributes on the single Matched output port will be accumulated in a list, with the name of the list provided as in the image:

Thanks - I didn't spot that.

 

So if you don't specify a list name or match count attribute name, you won't see it in the output.

 

But the features output through the SingleMatched port do have non-list attributes - are these the attributes of the first "version" of the matched feature that entered the transformer?

 


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • December 22, 2016

The Matcher documentation states:

"A single copy of each set of matched features is sent to the SingleMatched port. The attributes on these features will be merged onto the single output feature. So, Matcher is capable of doing multi-feature merging with geometry as the key. This complements FeatureMerger, which only accepts attributes, and not geometries, as keys."

Naturally if the same attributes exist on both features a different approach is necessary (prefixing is one way) to avoid the conflict.


tim_wood
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • December 22, 2016

The Matcher documentation states:

"A single copy of each set of matched features is sent to the SingleMatched port. The attributes on these features will be merged onto the single output feature. So, Matcher is capable of doing multi-feature merging with geometry as the key. This complements FeatureMerger, which only accepts attributes, and not geometries, as keys."

Naturally if the same attributes exist on both features a different approach is necessary (prefixing is one way) to avoid the conflict.

Yes but what attributes win?

 

If you've got these features going to the Matcher in this order, and being matched on the ID...

 

ID = 1, Field1 = A, Field2 = B, Field3 = C, Geometry = 123,654

 

ID = 1, Field1 = X, Field2 = <null>, Field3 = Z, Geometry = 123,654

 

What will the SingleMatched output attributes be if no list name is specified?

 


takashi
Celebrity
  • December 22, 2016

Hi @tim_wood, in my observation, the merging rule seems to be first win for each attribute as well as the "Merge Incoming Attributes" option in other transformers such as Aggregator. For example:

IDfieldAfieldBfieldCfieldDfidleEfieldF1A1<missing><null><missing><missing><missing>2A2<missing>C2<missing><null>F23<missing>B3C3D3E3F3

If the input is ordered by ID and all of them are matched, the single matched feature will have:

IDfieldAfieldBfieldCfieldDfieldEfieldF1A1B3<null>D3<null>F2

takashi
Celebrity
  • December 22, 2016

Hi @tim_wood, in my observation, the merging rule seems to be first win for each attribute as well as the "Merge Incoming Attributes" option in other transformers such as Aggregator. For example:

IDfieldAfieldBfieldCfieldDfidleEfieldF1A1<missing><null><missing><missing><missing>2A2<missing>C2<missing><null>F23<missing>B3C3D3E3F3

If the input is ordered by ID and all of them are matched, the single matched feature will have:

IDfieldAfieldBfieldCfieldDfieldEfieldF1A1B3<null>D3<null>F2
See also this attachment (FME 2016.1.3): matcher-singlematched-merging-attributes-rule.fmw