Stand: 25.08.2004


A
|
|--B
| |
| |--C
| |
| |--D
|
|--E
|
|--F
|--G


GRAU markiert ==> Knoten ist im Schema markiert
LILA markiert ==> Knoten hat GRAU markierte Nachfahren




current ==> aktueller XML Schema Knoten ( Bsp. C )
currentPath ==> Pfad zu current ohne current selbst ( Bsp. doc(my.xml)/A/B )
v ==> Variable der Iteration des Vaters ( Bsp. ... )
==> Variable enthält aktuellen Knoten
pathToChild ==> Pfad von $x aus XMLSchemaTreeToSPTree(_, _, $x) zu nächstem XMLSchema-Knoten




childInfo XMLSchemaTreeToSPTree ( XMLSchemaNode, XPath, Variable )


childInfo { SPTreeNode child, XPath pathToChild, childSelection String, Prädikat P }




childInfo XMLSchemaTreeToSPTree ( XMLSchemaNode current, XPath currentPath, Variable v )




// A: ********************************* COMPLEX Pfadverlängerung
wenn current nicht GRAU markiert / genau ein LILA oder GRAU Kind


sei current.child(x) das LILA markierte Kind




return XMLSchemaTreeToSPTree ( current.child(x), currentPath/current, v )






// B: ********************************* COMPLEX Ausgabeknoten
wenn current GRAU markiert / keine LILA oder GRAU Kind


new SPTreeNode




Selection: local-name(v) = current.name
Name: current.name
Simple Content: null
Iteration: null
Filter: null
Order:
keine Kinder


return {this, currentPath/*, current.name}






// C: ********************************* COMPLEX Ausgabeknoten / Verzweigungsknoten
wenn current GRAU markiert und mind. zwei LILA oder GRAU markierte Kinder y1 ... yn hat (n>1)


new SPTreeNode




Selection: local-name(v) = current.name
Name: current.name
Simple Content: null
Iteration: $x0 in v/*
Filter: local-name($x0) = 'y1' or ... or local-name($x0) = 'yn'
Order:
Kinder k1 ... kn des neuen Knoten sind
XMLSchemaTreeToSPTree ( yi, $x0, $x0 ).child für 1 =< i =< n


return {this, currentPath/*, current.name}






// D: ********************************* COMPLEX Ausgabeknoten / Abstiegsknoten
wenn current GRAU markiert und genau ein LILA oder GRAU markiertes Kind y


new SPTreeNode




Selection: local-name(v) = current.name
Name: current.name
Simple Content: null
Iteration: $x0 in (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).pathToChild
Filter: local-name($x0) = (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).childSel
Order:
Kind ist XMLSchemaTreeToSPTree ( y, $x0, $x0 ).child


return {this, currentPath/*, current.name}






// E: ********************************* COMPLEX Verzweigungsknoten
wenn current mind. zwei LILA markierte Kindern y1 ... yn hat



new SPTreeNode




Selection: local-name(v) = current.name
Name: null
Simple Content: null
Iteration: $x0 in v/*
Filter: local-name($x0) = 'y1' or ... or local-name($x0) = 'yn'
Order: ?
Kinder k1 ... kn des neuen Knoten sind
XMLSchemaTreeToSPTree ( yi, $x0, $x0 ).child für 1 =< i =< n


return {this, currentPath/*, current.name}






// F: ********************************* SIMPLE Ausgabeknoten
wenn current GRAU markiert und simple type


new SPTreeNode




Selection: local-name(v) = current.name
Name: null
wenn includeTag
Simple Content: v
wenn nicht includeTag
Simple Content: v/data()
Iteration: null
Filter: null
Order: null
keine Kinder


return {this, currentPath/*, current.name}






// G: ********************************* COMPLEX nicht-Ausgabeknoten mit ATTRIBUTE Ausgabeknoten
wenn current nicht GRAU aber LILA markiert und genau ein Kind y hat, das Attribut und GRAU markiert



new SPTreeNode




Selection: local-name(v) = current.name
Name:
Simple Content: null
Iteration: null
Filter: null
Order: null
Kind ist XMLSchemaTreeToSPTree ( y, currentPath/current.name, v ).child
(beachte Attribut-Ausgabeknoten)


return {this, currentPath/*, current.name}






// H: ********************************* ATTRIBUTE Ausgabeknoten
wenn current GRAU markiert und attribute type


new SPTreeNode




Selection: exists ( v/@current.name )
Name: node-name( v )
Simple Content: v/@current.name
Iteration: null
Filter: null
Order: null
keine Kinder


return {this, currentPath, current.father.name} // uninteressant






// I: ********************************* COMPLEX Ausgabeknoten mit ATTRIBUTE Ausgabeknoten
wenn current GRAU markiert / GRAU markietes Kind das Attribut ist


new SPTreeNode




Selection: local-name(v) = current.name
Name: node-name( v )
Simple Content: v/@current.attributechild.name
Iteration: $x0 in (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).pathToChild
Filter: local-name($x0) = (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).childSel
Order: null
Kind ist XMLSchemaTreeToSPTree ( current.child, $x0, $x0 ).child
(ignoriere Attribut-Ausgabeknoten)


return {this, currentPath/*, current.name}






// J: ********************************* COMPLEX Verzweigungsknoten mit ATTRIBUTE Ausgabeknoten
wie COMPLEX Verzweigungsknoten zzgl. ATTRIBUTE Ausgabeknoten - Kind neben der flwor-exp






// K: ********************************* COMPLEX Abstiegsknoten mit ATTRIBUTE Ausgabeknoten
wenn current LILA markiert und genau ein LILA Kind und ein GRAU markiertes Attribut-Kind


new SPTreeNode




Selection: local-name(v) = current.name
Name: null
Simple Content: null
Iteration: $x0 in (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).pathToChild
Filter: local-name($x0) = (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).childSel
Order: null
Kinder sind XMLSchemaTreeToSPTree ( current.child, $x0, $x0 ).child und
XMLSchemaTreeToSPTree ( current.attributechild, currentPath/current.name. v)
neben der flwor-exp


return {this, currentPath/*, current.name}






// L: **************************** COMPLEX an dem Prädikat angetragen ist (Verzweigung / Abstieg)
wenn current mind. zwei LILA oder GRAU markierte Kinder y1 ... yn hat (n>1) (Verzweigung)
oder wenn current genau ein LILA oder GRAU markiertes Kind y (Abstieg)
und Prädikat P angetragen ist
Bsp.: X: [='eineZeichenkette'] / Y: [=0.12358] / Z: [./pfad1/a = ./pfad2/b]
(bei Pfaden in Prädikaten wird der Punkt durch die Variable der Ebene ersetzt)
==> ganz normaler Knoten mit neuer Iteration ohne Ausgabe


new SPTreeNode




Selection: local-name(v) = current.name
Name: null
Simple Content: null
wenn Abstieg
Iteration: $x0 in (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).pathToChild
wenn Verzweigung
Iteration: $x0 in v/*
wenn Abstieg

Filter: local-name($x0) = (XMLSchemaTreeToSPTree ( current.child, $x0, $x0)).childSel

wenn Verzweigung
Filter: local-name($x0) = 'y1' or ... or local-name($x0) = 'yn'
Order: null
wenn Abstieg
Kind ist XMLSchemaTreeToSPTree ( current.child, $x0, $x0 ).child
wenn Verzweigung
Kinder k1 ... kn des neuen Knoten sind
XMLSchemaTreeToSPTree ( yi, $x0, $x0 ).child für 1 =< i =< n



return {this, currentPath/*, current.name}