When can language components be removed and maintain backwards or forwards compatibility?

| | Comments (0) | TrackBacks (0)

When can content be removed from a content model? The answer depends what we mean by "remove". The first aspect is whether the content is completely removed or if the minimum and/or maximum number of occurences of the content is reduced though possibly still allowed. The second aspect is whether the content that is removed from the definition is still allowed to occur in documents.

We will use a formal model of compatibility introduced in http://www.xml.com/pub/a/2006/12/20/a-theory-of-compatible-versions.html and the TAG versioning finding (terminology) which describe a language's Defined Text Set, Accept Text Set, and specifies compatibility possibilities between versions based upon the sets. A separate post illustrates various XML Schema designs.

In general, a newer language can be forwards and backwards compatible with an older language if the component is removed and still accepted. A newer language can be forwards compatible with an older language if the component is optional and is removed and not accepted. A newer language can be backwards compatible with an older language if the component is optional and is removed and not accepted only if the producers do not produce the optional component. A newer language cannot be backwards or forwards compatible with an older language if the component is required.

Remove and Accept
If we mean remove the definition but still accept the component, then in general the language can still be fully compatible. The theory is that the Language V2 "defined text set" (that is the texts/strings/documents that are explicitly defined by the language excluding open content models like wildcards) size is a subset of the Language V1 "Defined Text Set" (because the component is no longer defined) and the Language V2 "accept text set" ( that is the texts/strings/documents that are allowed by the language including any open content models) size is a superset of the Language V2 "Accept Text Set" (because the component's type is also removed), which is forwards and backwards compatible change. The relevent compatibility relationship from the TAG finding is

"Language L2 is fully strictly compatible with Language L1 if L1 Accept Text set > (superset) Language L2 Accept Text set > (superset) L2 Defined Text set > (superset) L1 Defined Text Set AND every text in L1 Defined Text set is compatible with L2 AND every text in L2 Accept Text set is compatible with L1."

The removal and acceptance satisfies these constraints.

Remove and not Accept
If we mean remove and not accept the component any more, then the options depend upon the cardinality of the element removed from V1 of the language.

minOccurs < maxOccurs
Under remove and not accept, elements with maxOccurs greater than minOccurs can have V2 maxOccurs reduced to the V1 minOccurs and the newer language is forwards compatible because a V2 producer will not produce the content up to the V1 maxOccurs. In the easy case, this means removing optional content is forwards compatible. The relevent rule from the TAG finding is

"Language L1 is strictly forwards compatible with Language L2 if L1 Accept Text set > (superset) Language L2 Accept Text set AND every text in L2 Accept Text set is compatible with L1."

But language V2 is not backwards compatible with V1 because a V1 producer may produce the content with cardinality greater than the new V2 "maxOccurs". This violates the backwards compatible rule as stated in the TAG finding as

"Language L2 is strictly backwards compatible with Language L1 if L2 Defined Text set > (superset) L1 Defined Text Set AND every text in L1 Defined Text set is compatible with L2."

In this scenario, the V2 Defined Text Set < (subset) the V1 Defined Text Set because items between the V1 minOccurs and the maxOccurs are not in the V2 Defined Text Set, hence the subset and violation of the superset requirement.

If the V1 producer only produces content within the new V2 maxOccurs (ie, producing 0 elements when V1 minOccurs="0") , then the V1 producer has effectively subsetted the V1 language such that the language it is using is backwards compatible with V2. This is one advantage of "partial understanding".

minOccurs == maxOccurs

It is not possible to create a language with V2 maxOccurs that is less than the V1 minOccurs (ie removing mandatory elements) and have V2 be forwards compatible with V1 because V1 consumers will not accept the V2 documents because there aren't enough occurences of the element. Under the same V2, V2 cannot be backwards compatible with V1 because V2 consumers will not accept the V1 documents because there are too many occurences of the element. The forwards and backwards compatibility rules from the TAG finding shown earlier are both violated.

0 TrackBacks

Listed below are links to blogs that reference this entry: When can language components be removed and maintain backwards or forwards compatibility?.

TrackBack URL for this entry: http://www.pacificspirit.com/cgi-bin/mt/mt-tb.cgi/151

Leave a comment

About this Entry

This page contains a single entry by Dave Orchard published on September 13, 2007 3:02 PM.

10 days to Grouse Grind Run was the previous entry in this blog.

Using XML Schema 1.0, when can language components be removed and maintain backwards or forwards compatibility? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories