A general approach to the mapping of alignments to navigations must be based on a generalized way of mapping semantic relationships assumed in the target model to structural relationships observed in the source model. Given a parent and a child location from the target model, we assume a semantic relationship between these locations and we also assume a similar semantic relationship to exist between the alignments of the target locations - between the alignment of the target parent location and the alignment of the target child location. The important point is that the cases where the alignments of a parent-child pair is itself a parent-child pair or an ancestor-descendant pair are handled as expected, yet regarded as special cases of a general rule. The approach requires a precise definition of the structural relationship existing between two arbitrary sets of nodes, supplied by the alignments of target parent and target child location. The definition is expressed as a navigation mapping a given node from the target parent alignment to a set of nodes from the target child alignment. The definition of the rule is ultimately arbitrary, and the challenge is to find a solution which matches intuitive expectations best and under the broadest set of circumstances.
We define the structural relationship between the alignments of parent and source locations as the shortest navigation path leading from the target parent alignment (which is one or more source locations) to the target child alignment (one or more source locations). The shortest path between two nodes A and B is defined as follows: (a) if A is descendant (ancestor) or B, the shortest path is along the descendant:: (ancestor::) axis; (b) otherwise the shortest path is a prefix leading from A to the nearest common ancestor C, followed by the path from C to B along the descendant:: axis. The following table compiles a few examples.
Table 7. Application of the “shortest-path-principle”.
Source alignment of parent node | Source alignment of child node | Shortest path |
---|---|---|
A/B/C | A/B/C/D | D |
A/B/C | A/B/C/D/E | D/E |
A/B/C | A/B | parent::B |
A/B/C | A | parent::B/parent::A |
A/B/C | A/B/X/Y | parent::B/X/Y |