XML Mapping Completeness Ratio

This metric asks the question “How complete a mapping can be made from a document in one schema to a document in another schema?” It can be used to judge whether some intended schema is capable of holding the information in an existing schema.

The metric is two numbers; the absolute values are of at least as much interest as the relative values, so we express them as a ration not a percentage. The ratio is formed using the following method:

  • For the left-hand side, in the “from” schema count all “fields”: these are elements and attributes that are not used for metadata, ID/IDREF or other linking, or for documentation. Don’t count container elements (elements which have element content only) but do count any non-container elements that are in a container.
  • For the right-hand side, count the number of fields from the “from” schema which have adequate mappings in the “to” schema. This right-hand number cannot be greater than the left-hand number; if they are the same, then there is a complete mapping.

The “from” schema does not have to be an XML schema: you could derive the number directly from a database schema by counting the number of non-key fields.

For example, say we have the following “from” schema (using DTD syntax for brevity):

	<!ELEMENT JapaneseAddress  (apartment?, floor?, number, block, town?, city, prefecture)>

and the following “to” schema:

	<!ELEMENT TaiwaneseAddress (apartment?, floor?, number, alley?, street, district?,
	city, province)>

Then the XML Mapping Completeness Ratio is 7:6. We can map town to suburb, but there is no specific equivalent to a Japanese block in the Taiwanese address nor is there some general element that can take the information. This result indicates that the fit is not perfect: the “to” schema must be dropped, adapted or the unmapped element dropped.