maprule Expressions

The maprule expression provides information about mapping rules. It is represented in the xfMap document with the <maprule> element, and it has the following general form:

<maprule expr=”...”/>

The expression string (i.e., the expr attribute) specifies the type of mapping rule information.

The following lists the valid values the expression string may take:

activate-count:

<maprule expr=”activate-count”/>

Returns the number of times a mapping rule has been activated.

Example

The example below illustrates several of the counter expression operations.

bin.xml

<?xml version=”1.0”?>
<bin>
	<item>I’m some sort of item inside this bin.</item>
	<item>What type of item may I be?</item>
	<item>I wouldn’t know.</item>
	<item>Why should I?</item>
	<item>Ask the bin.</item>
</bin>

maprule.xmp

<?xml version=”1.0”?>
<!DOCTYPE xfMap SYSTEM ”xfMap.dtd”>
<xfMap>
	<feature-map>
		<mapping match=”item”>
			<feature-type> <literal expr=”item”/> </feature-type>
			<attributes>
				<attribute>
					<name> <literal expr=”value”/> </name>
					<value><extract expr=”.”/> </value>
				</attribute>			
				<attribute>
					<name> <literal expr=”mapping-rule-activate-count”/> </name>
					<value><maprule expr=”activate-count”/> </value>
				</attribute>						
			</attributes>			
		</mapping>
	</feature-map>
</xfMap>

FME features constructed:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: `item'
Attribute(string): `mapping-rule-activate-count' has value `1'
Attribute(string): `value' has value `I'm some sort of item inside this bin.'
Attribute(string): `xml_type' has value `xml_no_geom'
Geometry Type: Unknown (0)
===================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: `item'
Attribute(string): `mapping-rule-activate-count' has value `2'
Attribute(string): `value' has value `What type of item may I be?'
Attribute(string): `xml_type' has value `xml_no_geom'
Geometry Type: Unknown (0)
===================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: `item'
Attribute(string): `mapping-rule-activate-count' has value `3'
Attribute(string): `value' has value `I wouldn't know.'
Attribute(string): `xml_type' has value `xml_no_geom'
Geometry Type: Unknown (0)
===================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: `item'
Attribute(string): `mapping-rule-activate-count' has value `4'
Attribute(string): `value' has value `Why should I?'
Attribute(string): `xml_type' has value `xml_no_geom'
Geometry Type: Unknown (0)
===================================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: `item'
Attribute(string): `mapping-rule-activate-count' has value `5'
Attribute(string): `value' has value `Ask the bin.'
Attribute(string): `xml_type' has value `xml_no_geom'
Geometry Type: Unknown (0)
===================================================================