I have tried to recreate the matrix that Marc produced when building the schema importer. I've changed the terminology a bit to something that I think is more understandable.
Key – These are the variables effect the selection of a relation and the subsequent folding.
Can_Be_Root = An element can be root if it has no parents.
F_Limit = The upper bound for No_F set by the user (which may be other code).
M = Multiplicity. The number of times the element appears within other elements.
M_Limit = The upper bound for M set by the user (which may be other code).
Mixed = The multiplicity of an element is mixed when it appears in one or more elements with different max occurs values. (Ex. The X element contains 3 Z elements, and the Y element contains 2 Z elements.)
No_F = The number of fields (attributes) the element has.
No_P = The number of different parents an element is contained within.
P_Limit = The upper bound for No_P set by the user (which may be other code).
F_Test = No_F > F or Can_Be_Root
Foldings – These are the relationships assigned to the elements that determine if the elements are folder or have foreign key relations estableished.
Key_in_Parent_Single – Place a foreign key in the parent element referencing this element's ID.
Key_in_Parent_Multiple – Place a foreign key in each parent element referencing this element's ID.
Key_In_Child – Place a foreign key in the child element referencing this element's ID.
Merge_in_Parent_Single – Merge this element into its parent as a column or columns.
Merge_in_Parent_Multiple – Merge this element into each of its parents a column or columns .
Relationship_Table – Create a relationship table relating this element to it's parents.
This matrix shows the relations that are created by the default relationship processor. The cells that are highlighted in yellow show the relations that are partially determined by the user defined variables. The blue highlighted cells relations are determined completely by the schema.
|
No_P = 0 |
No_P = 1 |
1 < No_P <= P_Limit |
P_Limit < No_P |
---|---|---|---|---|
M = 1 |
Key_in_Parent_Single |
F_Test = True then Key_in_Parent_Single else Merge_in_Parent_Single |
F_Test = True then Key_in_Parent_Single else Merge_in_Parent_Single |
Key_in_Parent_Single |
1 < M <= M_Limit |
Key_in_Parent_Single |
F_Test = True then Key_in_Parent_Multiple else Merge_in_Parent_Multiple |
F_Test = True then Key_in_Parent_Multiple else Merge_in_Parent_Multiple |
Key_in_Parent_Multiple |
M_Limit < M < Unbounded |
Key_in_Parent_Single |
Key_In_Child |
Relationship_Table |
Relationship_Table |
M = Unbounded |
Key_in_Parent_Single |
Key_In_Child |
Relationship_Table |
Relationship_Table |
M = Mixed |
Key_in_Parent_Single |
Is this a bug? |
Relationship_Table |
Relationship_Table |
Key_in_Parent_Single
(Case1)No_P = 0 and M = 1
(Case2)No_P = 0 and 1 < M <= M_Limit
(Case3)No_P = 0 and M_Limit < M < Unbounded
(Case4)No_P = 0 and M = Unbounded
(Case5)No_P = 0 and M = Mixed
(Case6)No_P = 1 and M = 1 and F_Test = True
(Case7)1 < No_P <= P_Limit and M = 1 and F_Test = True
(Case8)P_Limit < No_p and M = 1
Key_in_Parent_Multiple
(Case9)No_P = 1 and 1 < M <= M_Limit and F_Test = True
(Case10)1 < No_P and <= P_Limit and 1 < M <= M_Limit and F_Test = True
(Case11)P_Limit < No_P and 1 < M <= M_Limit
Merge_in_Parent_Single
(Case12)No_P = 1 and M = 1 and F_Test = False
(Case13)1 < No_P and <= P_Limit and 1 < M <= M_Limit and F_Test = False
Merge_in_Parent_Multiple
(Case14)No_P = 1 and 1 < M <= M_Limit and F_Test = False
(Case15)1 < No_P and <= P_Limit and 1 < M <= M_Limit and F_Test = False
Key_In_Child
(Case16)No_P = 1 and M_Limit < M < Unbounded
(Case17)No_P = 1 and M = Unbounded
Relationship_Table
(Case18)1 < No_P and <= P_Limit and M_Limit < M < Unbounded
(Case19)1 < No_P and <= P_Limit and M = Unbounded
(Case20)1 < No_P and <= P_Limit and M = Mixed
(Case21)P_Limit < No_P and M_Limit < M < Unbounded
(Case22)P_Limit < No_P and M = Unbounded
(Case23)P_Limit < No_P and M = Mixed