Persistent Groups

Agroupispersistentif thegroup mapping rulethat defines it has aelement.

Apersistent groupthat is not the last group in theg-stackwill not be destroyed when its correspondingmapping rulede-activates.

Note:A group mapping rule defined under the element may have a element, but this indication for the group to persist is always ignored by the XML Reader, this group, by construction, will always be the last one left in the g-stack (seeGroup Construction and Destruction).

When apersistent groupis popped from theg-stackit can persist inside otherg-stackgroups. Theelement has an optionalinattribute that specifies where it may persist. The valid values for this attribute areparent-groupandbase-group(whereparent_groupis the default value):

Theparent-groupof apersistent groupis thegroupthat will be at the top of theg-stackwhen thepersistent groupis popped. Thebase-groupis thegroupthat is at the base of theg-stack; it is the firstgrouppushed into the stack; it is thegroupconstructed from the activation of agroup mapping rulethat was defined under theelement.

FME features that are constructed byfeature mapping ruleswill enter all thegroupsthat are in theg-stackfrom the top until the bottom of the stack. If agroupin the stack haspersistent groups, then the features will first enter thepersistent groupsbefore entering into thegroup’s ownattribute setsandpipelines.

The following example shows whypersistent groupsare sometimes needed.

group_persist.xml

  C-23 Z-Edifice 580ld-3    

We want to map eachelement into an FME feature, but we’ll also like to attach the information from each of theelements to the member feature. The following xfMap document achieves this by the usage of persistent groups:

group_persist.xmp

         <!-- The group is constructed and pushed into the g-stack when the group-property start-tag is read, when the end-tag is read, then the group is popped from the g-stack. The group is not destroyed, it will persist in its parent-group, in this case it is the group that is constructed in the group-map above. We make this group persist, since otherwise this group is destroyed when the group-property element end-tag is read so that this group attribute set will not be attached to any feature.--> <persist/>                         

The two documents above make the XML Reader output the following FME features:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: `member-290' Attribute: `location' has value `Z-Edifice' Attribute: `op-code' has value `580ld-3' Attribute: `section' has value `C-23' Attribute: `xml_type' has value `xml_no_geom' Geometry Type: Unknown (0) =========================================================================== +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: `member-350' Attribute: `location' has value `Z-Edifice' Attribute: `op-code' has value `580ld-3' Attribute: `section' has value `C-23' Attribute: `xml_type' has value `xml_no_geom' Geometry Type: Unknown (0) =========================================================================== +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: `member-300' Attribute: `location' has value `Z-Edifice' Attribute: `op-code' has value `580ld-3' Attribute: `section' has value `C-23' Attribute: `xml_type' has value `xml_no_geom' Geometry Type: Unknown (0) ===========================================================================

Agroupactually contains two places where it may adoptpersistent groups. By default thegroupadopts apersistent groupin its low-priority list, theelement has an optionalpriorityattribute that specifies if apersistent groupshould be adopted into a group’s low- or high-priority lists.

Agroupwill always process FME features through its high-prioritypersistent groupsbefore the low-priority ones. The valid values for thepriorityattribute arelowandhigh, withlowbeing the default value.

For example, the followinggroup mapping ruledefines apersistent groupto persist in its parent group high-priority list:

  <persist in=”parent-group” priority=”high”/> ...