| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- exclude-result-prefixes="xs"
- xmlns:grapht="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/graph_tree/graph_tree.xsd"
- xmlns:get_wfs_recurse_xsl="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/get_wfs_recurse_xsl.xsd"
- xmlns:y="http://www.yworks.com/xml/graphml"
- xmlns:wfs="http://www.opengis.net/wfs"
- xmlns:gml="http://www.opengis.net/gml"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:p5="https://biuro.biall-net.pl/wfs"
- xmlns:default_db__x3A__BI_audit_ENERGA_PRACOWNICY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_PRACOWNICY"
- xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI"
- xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row"
- xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object"
- xmlns:default_db__x3A__BI_audit_taxpayer="https://biuro.biall-net.pl/wfs/default_db/BI_audit_taxpayer"
- xmlns:default_db__x3A__TERYT_adresy="https://biuro.biall-net.pl/wfs/default_db/TERYT_adresy"
- xmlns:default_db__x3A__BI_audit_KRS="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS"
- xmlns:default_db__x3A__BI_audit_KRS_person="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS_person"
- xmlns:default_db__x3A__BI_audit_KRS_company="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS_company"
- xmlns:default_db__x3A__BI_audit_MSIG="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG"
- xmlns:default_db__x3A__BI_audit_MSIG_person="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_person"
- xmlns:default_db__x3A__BI_audit_MSIG_company="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_company"
- xmlns:default_db__x3A__BI_audit_MSIG_name="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_name"
- xmlns:default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_PRACOWNICY_adresy"
- xmlns:xp5r="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache.public/xinclude_p5_recurse/xinclude_p5_recurse.xsd"
- version="2.0">
-
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
-
- <xsl:template match="get_wfs_recurse_xsl:context.PRIMARYKEY|get_wfs_recurse_xsl:nodes" mode="#all"/>
- <xsl:param name="grapht.temp"/>
- <xsl:param name="debug.filter" select="'(9177)|(9177)'"/>
- <xsl:param name="grapht.xsl.testing"/>
- <xsl:param name="grapht.testing.analyze_nodes.grapht.fid.xml"/>
-
-
- <xsl:key name="fid" match="*" use="@grapht:fid"/>
- <xsl:key name="descendant-or-self" match="*" use="descendant-or-self::*/@grapht:fid"/>
- <xsl:key name="descendant" match="*" use="descendant::*/@grapht:fid"/>
- <!--<xsl:key name="descendant" match="descendant::" use="@grapht:fid"/>-->
- <xsl:key name="ancestor" match="*" use="ancestor::*/@grapht:fid"/>
- <!--<xsl:key name="ancestor" match="ancestor::*" use="@grapht:fid"/>-->
-
- <!--
- założenia:
-
- - graf ma max głębokość $maxDeepth -
- - w zależności od $maxDeepth, tyle razy się powiązuje rekursywnie wszystkie @xlinki, aby wyliczyć długości ścieżek do wszystkich węzłów.
- - wyzwolenie liczenia powiązań do wszystkich ścieżek wyzwalamy od jakiegos poziomu do szczytu $currentStartDeepth,
- tyle razy dokladamy rekursywnie @xlink, aby osiągnąć $maxDeepth ($toTraverseDeept = $maxDeepth - $currentStartDeepth)
- - todo kierunkowe relacje na razie ignorujemy (@backReffed), do rozwazenia implementacji w obliczeniach aby nie liczyc sciezek,
- dotyczących relacji przebiegajacych przez backreffy - pytanie w jakich jest to zaleznosciach - do przeanalizowania
- - szukamy zawsze listy elementow, dla każdego elementu:
- - w górę
- - w dół
- - @grapht:ancestor.path.len = dlugosc pomiedzy parentem i dzieckiem = $grapht:parent.ancestor.count - $grapht:ancestor.count w elemencie grapht:analyze_nodes.tree.ancestors
-
- - drugie przetworzenie umożliwi znalezienie tras pomiedzy elementami suma z gory + kawalek do gory - bierzemy ktory krótszy
-
-
-
- Plan B
- - jaka odleglosc od FID do FID i najkrotsza sciezka?
-
- 1 szukam samych koncow dzieci z xlink,
- 2 dla kazdego z nich jade sciezki do root - moga byc wiele razy
- 3 dla kazdego z nich sciezki do child (sa do zsumowania) - sa na koncach - bez sensu
-
- C
- mamy unikalne sciezki w grapht:last_child.fid
- kazdy wezel ma przypisana grapht:last_child.fid - mozna zgrupowac - i po tych wariantach szukac
- dla kazdego wezla group by grapht:last_child.fid szukam dlugosci do innego :
- - szukam w jakich sciezkach jest tamten wezel i uzywam @grapht:ancestor.path.len
- foreach grapht:analyze_nodes.tree group by ../@grapht:last_child.fid
- szukam grapht:analyze_nodes.tree[ have grapht:analyze_nodes.tree.childs ]
-
- deb[5] BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619448 to
- [4] BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619447
-
- tracking manually:
- BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619448 - source
- ../BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.241314
- ../BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619449
- ../BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.241314
- ../BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619448
- ../BI_audit_ENERGA_PRACOWNICY.9 (root)
- ./BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619441
- ./BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.241313
- ./BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619447 - cel
- dlugosc = 9
-
- <grapht:analyze_nodes.tree fid="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619448"
- p5:primaryKey="1619448"
- xlink:href=""
- grapht:pos="1"
- grapht:anchestor.count="3"
- grapht:childs.count="202"
- grapht:last_child.fid="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619448"
- grapht:fid="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619448">
- <grapht:analyze_nodes.tree.childs grapht:parent.childs.count="202" grapht:parent.ancestor.count="3"/>
- </grapht:analyze_nodes.tree>
-
- <grapht:analyze_nodes.tree fid="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619447"
- p5:primaryKey="1619447"
- xlink:href=""
- grapht:pos="21"
- grapht:anchestor.count="5"
- grapht:childs.count="87"
- grapht:last_child.fid="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619441"
- grapht:fid="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619447">
- <grapht:analyze_nodes.tree.childs grapht:parent.childs.count="87" grapht:parent.ancestor.count="5"/>
- </grapht:analyze_nodes.tree>
-
- - inne last_child.fid
-
-
-
-
- - sprawdzmy cos co sie dzieli w srodku
- np: BI_audit_KRS_person.150746 [4]
- do BI_audit_ENERGA_RUM_KONTRAHENCI.9177 [7]
-
- sciezka:
- BI_audit_ENERGA_RUM_KONTRAHENCI.9177
- ../BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619451
- ../BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.241314 (local root)
- ./BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.1619449
- ./BI_audit_KRS_person.150746
-
-
- plan D
- dla kazdego kto nie ma sciezek,
- wychodzmy pietro wyzej i patrzymy, czy widzimy dziecko,
- jak nie wyzej
-
-
-
- -->
-
- <!--
-
- a.binder Metody optumalizacji wizualizacji danych do weryfikacji czy są gotowe funckje/biblioteki do tego
-
- 1) NearestMiddleShortcut
- A - B - C => A - - - C
-
- 2) MiddlePathShortcut
- A - B - C - D => A - - - D
-
- 3) MiddleGroup
- - C1 - D1 / - D1
- A - B + => A [B: C1,C2 ] -
- - C2 - D2 \ - D2
-
-
- 4) CutPath
- A - B - C - D => C - D
-
-
- 5) TypesGroup
-
- A1 - B1 - C1
- A2 - B2 - C2 => [ A1, A2, A3 ] = [ B1, B2, B3 ] = [ C1, C2, C3 ]
- A3 - B3 - C3
-
-
- 6) TypesAndFlowsGroup
- [ ] - - - - - - [ ]
- A1 - B1 - C1 [ A1 ] [ B1 ]- - [ C1 ]
- C2 - B2 - A2 => [ B2 ]- - [ A2 ] [ C3 ]
- B3 - A3 - C3 [ B3 ] [ A3 ]
-
-
-
-
- mixing this types also
-
-
-
-
- -->
-
-
- <xsl:function name="wfs:primary_key">
- <xsl:param name="xlink:href"/>
- <xsl:variable name="tokens" select="count(tokenize($xlink:href,'\.'))"/>
- <xsl:value-of select="tokenize($xlink:href,'\.')[$tokens]"/>
- </xsl:function>
-
-
-
- <xsl:function name="wfs:namespace">
- <xsl:param name="xlink:href"/>
- <xsl:value-of select=" substring-before($xlink:href,'#')"/>
- </xsl:function>
-
-
-
-
- <xsl:function name="wfs:element">
- <xsl:param name="xlink:href"/>
- <xsl:variable name="element_w_fid" select="substring-after($xlink:href,'#')"/>
- <xsl:value-of select="substring-before($element_w_fid,'.')"/>
- </xsl:function>
-
-
- <xsl:function name="wfs:fid">
- <xsl:param name="xlink:href"/>
- <xsl:if test="string-length($xlink:href) >0">
- <xsl:value-of select="concat( wfs:element($xlink:href),'.', wfs:primary_key($xlink:href))"/>
- </xsl:if>
- </xsl:function>
-
- <xsl:template match="@fid" mode="grapht:fid">
- <xsl:attribute name="grapht:fid" select="."/>
- </xsl:template>
- <xsl:template match="@xlink:href" mode="grapht:fid">
- <xsl:attribute name="grapht:fid" select="wfs:fid(.)"/>
- </xsl:template>
-
- <xsl:template match="@*" mode="grapht:fid"/>
-
-
-
- <xsl:template match="wfs:FeatureCollection" mode="grapht:analyze_nodes">
- <grapht:analyze_nodes>
- <xsl:for-each-group select=".//*[(*|@xlink:href) and not(name()='gml:featureMember')]" group-by="name()">
- <xsl:copy copy-namespaces="no">
- <xsl:attribute name="grapht:count" select="count(current-group())"/>
- <xsl:attribute name="grapht:count.xlink" select="count(current-group()[@xlink:href])"/>
- <xp5r:cache xmlns:xp5r="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache.public/xinclude_p5_recurse/xinclude_p5_recurse.xsd"
- xp5r:id="{local-name()}"
- xp5r:basedir="{$grapht.temp}"
- xp5r:stylesheet="{$grapht.xsl.testing}">
- <xp5r:namespace namespace="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/graph_tree/graph_tree.xsd" name="grapht"/>
- <xp5r:namespace namespace="http://www.opengis.net/wfs" name="wfs"/>
- <xp5r:namespace namespace="http://www.opengis.net/gml" name="gml"/>
- <xp5r:namespace namespace="http://www.w3.org/1999/xlink" name="xlink"/>
- <xp5r:param name="debug.filter" value="{$debug.filter}"/>
- <xp5r:apply-template mode="grapht:analyze_nodes.xp5r" select=".">
- <xp5r:context-node>
- <xp5r:for-each-group
- select="doc('{$grapht.testing.analyze_nodes.grapht.fid.xml}')/wfs:FeatureCollection//*[(*|@xlink:href) and not(name()='gml:featureMember') and name()='{name()}']"
- group-by="name()"/>
- </xp5r:context-node>
- <!--<xsl:apply-templates mode="grapht:analyze_nodes.xp5r" select="."/>-->
- </xp5r:apply-template>
- </xp5r:cache>
- </xsl:copy>
- </xsl:for-each-group>
- </grapht:analyze_nodes>
- </xsl:template>
-
-
-
- <xsl:template match="*" mode="grapht:analyze_nodes.xp5r">
- <grapht:analyze_fid><!-- for name grouped -->
- <!--<debug.copy>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <current.group>
- <xsl:copy-of select="current-group()"/>
- </current.group>
- <current.root>
- <xsl:copy-of select="root()"/>
- </current.root>
- </xsl:copy>
- </debug.copy>-->
- <!--<xsl:for-each-group select="current-group()[ matches(@p5:primaryKey,$debug.filter) ]" group-by="@fid">-->
- <xsl:for-each select="current-group()[ count(descendant::*[* |@xlink:href]) >0 and matches(@p5:primaryKey,$debug.filter) ]"> <!-- FILTER -->
- <xsl:message>#136 maching @fid=<xsl:value-of select="@fid"/>; for matches(@p5:primaryKey=<xsl:value-of select="@p5:primaryKey"/>,$debug.filter=<xsl:value-of select="$debug.filter"/>) </xsl:message>
- <grapht:analyze_nodes.tree>
- <xsl:attribute name="fid" select="@fid"/>
- <xsl:attribute name="p5:primaryKey" select="@p5:primaryKey"/>
- <xsl:attribute name="xlink:href" select="@xlink:href"/>
- <xsl:attribute name="grapht:pos" select="position()"/>
- <xsl:variable name="grapht:anchestor.count" select=" count(ancestor::*)"/>
- <xsl:attribute name="grapht:anchestor.count" select="$grapht:anchestor.count"/>
- <xsl:variable name="grapht:childs.count" select="count(descendant::*[* |@xlink:href])"/>
- <xsl:attribute name="grapht:childs.count" select="$grapht:childs.count"/>
- <xsl:variable name="grapht:last_child.fid" select="descendant::*[ * | @xlink:href][$grapht:childs.count]/concat(@fid,wfs:fid(@xlink:href))"/>
- <xsl:attribute name="grapht:last_child.fid" select="$grapht:last_child.fid"/>
- <!--<xsl:attribute name="grapht:root.fid" select=" ancestor::*[@fid][1]/@fid"/>-->
- <xsl:apply-templates mode="grapht:fid" select="@*"/>
- <!--<xsl:copy copy-namespaces="no">-->
- <!--<xsl:attribute name="fid" select="@fid"/>-->
- <!--<grapht:analyze_nodes.tree.childs>
- <xsl:attribute name="grapht:parent.childs.count" select="$grapht:childs.count"/>
- <xsl:attribute name="grapht:parent.ancestor.count" select="count( ancestor::*)"/>
- <!-\-<xsl:apply-templates mode="grapht:analyze_nodes.tree.childs" select="descendant::*[*|@xlink:href]">
- <xsl:with-param name="grapht:parent.childs.count" select="$grapht:childs.count"/>
- <xsl:with-param name="grapht:parent.ancestor.count" select="count(ancestor::*)"/>
- <xsl:with-param name="grapht:last_child.fid" select="$grapht:last_child.fid"/>
- </xsl:apply-templates>-\->
- <!-\-<xsl:for-each-group select="descendant::*[*|@xlink:href]" group-by="concat(@fid,wfs:fid(@xlink:href))">
- <xsl:apply-templates mode="grapht:analyze_nodes.tree.childs" select=".">
- <xsl:with-param name="grapht:parent.childs.count" select="$grapht:childs.count"/>
- <xsl:with-param name="grapht:parent.ancestor.count" select="count(ancestor::*)"/>
- <xsl:with-param name="grapht:last_child.fid" select="$grapht:last_child.fid"/>
- </xsl:apply-templates>
- </xsl:for-each-group>-\->
- </grapht:analyze_nodes.tree.childs>-->
- <!--<grapht:analyze_nodes.xlink.rebuild_tree_inputs>
- <xsl:attribute name="debug">#147 temporary disabled</xsl:attribute>
- <!-\-<xsl:for-each select=" current-group()[@xlink:href and matches(@p5:primaryKey,$debug.filter) ]" > <!-\\- -group group-by="@fid" -\\->
- <xsl:sort select="count(ancestor::node())"/>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:variable name="grapht.fid" select="wfs:fid(@xlink:href)"/>
- <xsl:attribute name="grapht.fid" select="$grapht.fid"/>
- <xsl:attribute name="grapht:ancestor.count" select="count(ancestor::node())"/>
- <xsl:apply-templates mode="grapht:analyze_nodes.xlink.rebuild_tree" select="root()//*[*[@fid= $grapht.fid ]]"> <!-\\- and * -\\->
- <xsl:with-param name="fid" select="$grapht.fid"/>
- <xsl:with-param name="root.node" select="root()"/>
- </xsl:apply-templates>
- </xsl:copy>
- </xsl:for-each>-\->
- </grapht:analyze_nodes.xlink.rebuild_tree_inputs>-->
- <!--</xsl:copy>-->
-
- <grapht:analyze_nodes.tree.clousure.searched>
- <xsl:variable name="current.parent.fid" select="@grapht:fid"/>
-
- <xsl:for-each select="root()//*[ not(@grapht:fid = $current.parent.fid) and (* or @xlink:href or @fid) and ( matches(@p5:primaryKey,$debug.filter) )]"> <!-- or matches($current.parent.fid,$debug.filter) FILTER -->
- <!--<xsl:message>#280 searching path from <xsl:value-of select="$current.parent.fid"/> to <xsl:value-of select="concat(@fid,wfs:fid(@xlink:href))"/></xsl:message>-->
- <grapht:path_to>
- <xsl:attribute name="grapht:fid" select="@grapht:fid"/>
- <xsl:choose>
- <xsl:when test="ancestor::*[@grapht:fid=$current.parent.fid ]"><!--<xsl:when test="ancestor::*[@grapht:fid=$current.parent.fid ]">--> <!-- key('ancestor',$current.parent.fid) -->
-
- <!--<xsl:message>#285 parent path found for <xsl:value-of select="$current.parent.fid"/> </xsl:message>-->
- <xsl:variable name="curr.ancerstor.count" select="count(ancestor::*)"/> <!-- -->
- <xsl:variable name="parent.ancerstor.count" select="ancestor::*[@grapht:fid=$current.parent.fid][1]/count(ancestor::*)"/> <!-- select="ancestor::*[@grapht:fid=$current.parent.fid][1]/count(ancestor::*)" --> <!-- key('ancestor',$current.parent.fid)[1]/count(ancestor::*) -->
- <xsl:variable name="grapht:path" select="$curr.ancerstor.count - $parent.ancerstor.count"/>
- <grapht:path_info>
- <xsl:attribute name="curr.ancerstor.count" select="$curr.ancerstor.count"/>
- <xsl:attribute name="parent.ancerstor.count" select="$parent.ancerstor.count"/>
- <xsl:attribute name="grapht:path" select="$grapht:path"/>
- <xsl:attribute name="grapht:node_from" select="@grapht:fid"/>
- <xsl:attribute name="grapht:when" select="'ancestor'"/>
- </grapht:path_info>
- <grapht:path_step>
- <!--<xsl:copy-of select="@grapht:fid"/>-->
- <xsl:copy-of select="@p5:primaryKey"/>
- <xsl:attribute name="local-name" select="local-name()"/>
- </grapht:path_step>
- <xsl:for-each select="ancestor::* [ count(ancestor::*) >= $parent.ancerstor.count]"> <!-- ancestor::* [ count(ancestor::*) >= $parent.ancerstor.count] -->
- <!-- <xsl:if test=" count(ancestor::*) > $parent.ancerstor.count ">-->
- <grapht:path_step>
- <!--<xsl:copy-of select="@grapht:fid"/>-->
- <xsl:copy-of select="@p5:primaryKey"/>
- <xsl:attribute name="local-name" select="local-name()"/>
- <!--<xsl:attribute name="debug.anc.count" select="count(ancestor::*)"/>-->
- </grapht:path_step>
- <!--</xsl:if>-->
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode="grapht:analyze_nodes.tree.clousure.searched" select="." >
- <xsl:with-param name="current.parent.fid" select="$current.parent.fid"/>
- <xsl:with-param name="grapht:fid" select="@grapht:fid"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </grapht:path_to>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.clousure.searched>
- </grapht:analyze_nodes.tree>
- </xsl:for-each>
- <!--</xsl:for-each-group>-->
- </grapht:analyze_fid>
- </xsl:template>
-
-
-
- <xsl:template match="*" mode="grapht:analyze_nodes.tree.childs">
- <xsl:param name="grapht:parent.childs.count" required="yes"/>
- <xsl:param name="grapht:parent.ancestor.count" required="yes"/>
- <xsl:param name="grapht:last_child.fid" required="yes"/>
- <xsl:variable name="grapht:childs.count" select="count(descendant::*[* |@xlink:href])"/>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:attribute name="grapht:last_child.fid" select="descendant::*[ * | @xlink:href][$grapht:childs.count]/concat(@fid,wfs:fid(@xlink:href))"/>
- <xsl:apply-templates mode="grapht:fid" select="@*"/>
- <xsl:attribute name="grapht:ancestor.count" select="count(ancestor::*)"/>
- <xsl:attribute name="grapht:childs.count" select="$grapht:childs.count"/>
- <xsl:attribute name="grapht:parent.ancestor.count" select="$grapht:parent.ancestor.count"/>
- <xsl:attribute name="grapht:ancestor.path.len" select="count(ancestor::*) - $grapht:parent.ancestor.count"/>
- <xsl:attribute name="grapht:last_child.fid" select="$grapht:last_child.fid"/>
- </xsl:copy>
- </xsl:template>
-
-
- <xsl:template match="*[not(@fid or @xlink:href)]" mode="grapht:analyze_nodes.tree.childs"/>
-
-
-
- <xsl:template match="*" mode="grapht:analyze_nodes.xlink.rebuild_tree">
- <xsl:param name="fid" required="yes"/>
- <xsl:param name="root.node" required="yes"/>
- <xsl:copy copy-namespaces="no">
- <!--<xsl:element name="{../name()}">-->
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="grapht:fid" select="@*"/>
- <!--</xsl:element>-->
- </xsl:copy>
- </xsl:template>
-
- <!-- todo unique grapht:analyze_nodes.tree.ancestors -->
-
-
- <xsl:template match="grapht:analyze_nodes" mode="grapht:analyze_nodes.paths">
- <grapht:analyze_nodes.paths>
- <xsl:apply-templates mode="grapht:analyze_nodes.paths"/>
- </grapht:analyze_nodes.paths>
- </xsl:template>
-
- <xsl:template match="*" mode="grapht:analyze_nodes.paths">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="grapht:fid" select="@*"/>
- <xsl:apply-templates mode="grapht:analyze_nodes.paths"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="gml:featureMember" mode="grapht:analyze_nodes.paths grapht:analyze_nodes.paths.unique"/>
-
-
-
- <xsl:template match="grapht:analyze_fid" mode="grapht:analyze_nodes.paths">
- <!-- szukam unkalnych parentow jakie mam, z najkrotsza sciezka
- , a potem szukam dla nich jakie oni maja dzieci unikalne, najkrotsze sciezki
- -->
- <xsl:message>#217 running grapht:analyze_nodes.paths with debug.filter=<xsl:value-of select="$debug.filter"/></xsl:message>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:for-each select="grapht:analyze_nodes.tree" > <!-- group-by="@fid" -->
- <xsl:message>#221 foreach grapht:analyze_nodes.tree @grapht:fid=<xsl:value-of select="@grapht:fid"/>; @grapht:pos=<xsl:value-of select="@grapht:pos"/>; group-by="@fid"=<xsl:value-of select="@fid"/>; @p5:primaryKey=<xsl:value-of select="@p5:primaryKey"/>; </xsl:message>
- <xsl:variable name="current.parent.fid" select="@grapht:fid"/>
- <xsl:variable name="current.parent.pos" select="@grapht:pos"/>
- <xsl:variable name="grapht:last_child.fid" select="@grapht:last_child.fid"/>
- <xsl:variable name="grapht:anchestor.count" select="@grapht:anchestor.count"/>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.clousure>
- <!--<xsl:attribute name="debug.288"> looking for @grapht:last_child.fid=$grapht:last_child.fid = <xsl:value-of select="$grapht:last_child.fid"/> ] </xsl:attribute>-->
- <xsl:for-each select="root()//grapht:analyze_nodes.tree[not(@grapht:fid = $current.parent.fid) and @grapht:last_child.fid=$grapht:last_child.fid and ( matches(@p5:primaryKey,$debug.filter) or matches($current.parent.fid,$debug.filter) ) ]"> <!-- FILTER -->
- <grapht:path>
- <xsl:attribute name="grapht:path.len" select="$grapht:anchestor.count - number(@grapht:anchestor.count) "/>
- <xsl:attribute name="grapht:fid" select="@grapht:fid"/>
- <xsl:copy-of select="@*"/>
- </grapht:path>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.clousure>
- </xsl:copy>
- </xsl:for-each>
- </xsl:copy>
- </xsl:template>
-
- <!--<xsl:template match="grapht:analyze_fid" mode="grapht:analyze_nodes.paths">
- <!-\- szukam unkalnych parentow jakie mam, z najkrotsza sciezka
- , a potem szukam dla nich jakie oni maja dzieci unikalne, najkrotsze sciezki
- -\->
- <xsl:message>#217 running grapht:analyze_nodes.paths with debug.filter=<xsl:value-of select="$debug.filter"/></xsl:message>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:for-each select="grapht:analyze_nodes.tree" > <!-\- group-by="@fid" -\->
- <xsl:message>#221 foreach grapht:analyze_nodes.tree @grapht:fid=<xsl:value-of select="@grapht:fid"/>; @grapht:pos=<xsl:value-of select="@grapht:pos"/>; group-by="@fid"=<xsl:value-of select="@fid"/>; @p5:primaryKey=<xsl:value-of select="@p5:primaryKey"/>; </xsl:message>
- <xsl:variable name="current.parent.fid" select="@grapht:fid"/>
- <xsl:variable name="current.parent.pos" select="@grapht:pos"/>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.ancestors>
- <xsl:for-each select="grapht:analyze_nodes.tree.childs/*[ matches(@p5:primaryKey,$debug.filter) ]" ><!-\-group-by="@fid" FILTERING -\->
- <xsl:sort select="@grapht:fid"/>
- <xsl:variable name="current.analyze_nodes.tree.ancestors.fid" select="@grapht:fid"/>
- <!-\-<xsl:variable name="current.analyze_nodes.tree.ancestors.pos" select="@grapht:pos"/>-\->
- <xsl:message>#245 current.analyze_nodes.tree.ancestors.fid=<xsl:value-of select="@grapht:fid"/>; <!-\-@grapht:pos=<xsl:value-of select="@grapht:pos"/>;-\-></xsl:message>
- <!-\- grapht:ancestor.path.len -\->
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.childs.paths.to_childs>
- <!-\- <xsl:for-each select="current-group()">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>-\->
- <grapht:analyze_nodes.tree.childs.paths.to_childs.childs>
- <xsl:attribute name="debug">#223 dla znalezionych ojcow, szukam innych dzieci </xsl:attribute>
- <xsl:for-each select="root()//grapht:analyze_fid/grapht:analyze_nodes.tree[not(@grapht:fid=$current.parent.fid)]/grapht:analyze_nodes.tree.childs/*[@grapht:fid = $current.analyze_nodes.tree.ancestors.fid and matches(@p5:primaryKey,$debug.filter)]"> <!-\- FILTER -\->
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <!-\-<xsl:for-each select="ancestor::*">
- <ancestor>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- </xsl:copy>
- </ancestor>
- </xsl:for-each>-\->
- </xsl:copy>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.childs.paths.to_childs.childs>
- <!-\-</xsl:copy>
- </xsl:for-each>-\->
- </grapht:analyze_nodes.tree.childs.paths.to_childs>
- </xsl:copy>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.ancestors>
- </xsl:copy>
- </xsl:for-each>
- </xsl:copy>
- </xsl:template>-->
-
- <!--<xsl:template match="grapht:analyze_fid" mode="grapht:analyze_nodes.paths">
- <!-\- szukam unkalnych parentow jakie mam, z najkrotsza sciezka
- , a potem szukam dla nich jakie oni maja dzieci unikalne, najkrotsze sciezki
- -\->
- <xsl:message>#217 running grapht:analyze_nodes.paths with debug.filter=<xsl:value-of select="$debug.filter"/></xsl:message>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:for-each select="grapht:analyze_nodes.tree" > <!-\- group-by="@fid" -\->
- <xsl:message>#221 foreach grapht:analyze_nodes.tree @grapht:fid=<xsl:value-of select="@grapht:fid"/>; @grapht:pos=<xsl:value-of select="@grapht:pos"/>; group-by="@fid"=<xsl:value-of select="@fid"/>; @p5:primaryKey=<xsl:value-of select="@p5:primaryKey"/>; </xsl:message>
- <xsl:variable name="current.parent.fid" select="@grapht:fid"/>
- <xsl:variable name="current.parent.pos" select="@grapht:pos"/>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.ancestors>
- <xsl:for-each select="grapht:analyze_nodes.tree.childs/*[ matches(@p5:primaryKey,$debug.filter) ]" ><!-\-group-by="@fid" FILTERING -\->
- <xsl:sort select="@grapht:fid"/>
- <xsl:variable name="current.analyze_nodes.tree.ancestors.fid" select="@grapht:fid"/>
- <!-\-<xsl:variable name="current.analyze_nodes.tree.ancestors.pos" select="@grapht:pos"/>-\->
- <xsl:message>#245 current.analyze_nodes.tree.ancestors.fid=<xsl:value-of select="@grapht:fid"/>; <!-\-@grapht:pos=<xsl:value-of select="@grapht:pos"/>;-\-></xsl:message>
- <!-\- grapht:ancestor.path.len -\->
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.childs.paths.to_childs>
- <!-\- <xsl:for-each select="current-group()">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>-\->
- <grapht:analyze_nodes.tree.childs.paths.to_childs.childs>
- <xsl:attribute name="debug">#223 dla znalezionych ojcow, szukam innych dzieci </xsl:attribute>
- <xsl:for-each select="root()//grapht:analyze_fid/grapht:analyze_nodes.tree[not(@grapht:fid=$current.parent.fid)]/grapht:analyze_nodes.tree.childs/*[@grapht:fid = $current.analyze_nodes.tree.ancestors.fid and matches(@p5:primaryKey,$debug.filter)]"> <!-\- FILTER -\->
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <!-\-<xsl:for-each select="ancestor::*">
- <ancestor>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- </xsl:copy>
- </ancestor>
- </xsl:for-each>-\->
- </xsl:copy>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.childs.paths.to_childs.childs>
- <!-\-</xsl:copy>
- </xsl:for-each>-\->
- </grapht:analyze_nodes.tree.childs.paths.to_childs>
- </xsl:copy>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.ancestors>
- </xsl:copy>
- </xsl:for-each>
- </xsl:copy>
- </xsl:template>-->
-
-
- <!--<xsl:template match="*" mode="grapht:analyze_nodes.paths.analyze_fid">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <!-\- szukam unkalnych parentow jakie mam, z najkrotsza sciezka
- , a potem szukam dla nich jakie oni maja dzieci unikalne, najkrotsze sciezki
- -\->
- <xsl:for-each-group select=""></xsl:for-each-group>
-
- </xsl:copy>
- </xsl:template>-->
-
- <xsl:template match="*" mode="grapht:analyze_nodes.grapht.fid">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="grapht:fid" select="@*"/>
- <xsl:apply-templates mode="#current"/>
- </xsl:copy>
- </xsl:template>
-
-
- <xsl:template match="grapht:analyze_nodes.paths" mode="grapht:analyze_nodes.paths.unique">
- <grapht:analyze_nodes.paths.unique>
- <xsl:apply-templates mode="#current"/>
- </grapht:analyze_nodes.paths.unique>
- </xsl:template>
-
-
- <xsl:template match="*" mode="grapht:analyze_nodes.paths.unique">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="grapht:fid" select="@*"/>
- <xsl:apply-templates mode="grapht:analyze_nodes.paths.unique"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="grapht:analyze_fid" mode="grapht:analyze_nodes.paths.unique">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
-
- <xsl:for-each select="grapht:analyze_nodes.tree">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:variable name="grapht:anchestor.count" select="@grapht:anchestor.count"/>
- <xsl:variable name="current.parent.fid" select="@grapht:fid"/>
- <xsl:message>#437 mode grapht:analyze_nodes.paths.unique @grapht:fid=<xsl:value-of select="@grapht:fid"/>; </xsl:message>
- <xsl:copy-of select="grapht:analyze_nodes.tree.clousure"/>
- <grapht:analyze_nodes.tree.clousure.referred>
- <xsl:attribute name="debug.452.current.parent.fid" select="$current.parent.fid"/>
- <xsl:attribute name="grapht:anchestor.count" select="$grapht:anchestor.count"/>
- <xsl:for-each select="root()//*[grapht:analyze_nodes.tree.clousure[grapht:path[@grapht:fid = $current.parent.fid]]]">
- <xsl:copy copy-namespaces="no">
- <xsl:attribute name="grapht:path.len" select=" number($grapht:anchestor.count) - number(@grapht:anchestor.count)"/>
- <xsl:copy-of select="@*"/>
- </xsl:copy>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.clousure.referred>
-
- </xsl:copy>
- </xsl:for-each>
- </xsl:copy>
- </xsl:template>
-
-
- <xsl:template match="*" mode="grapht:analyze_nodes.tree.clousure.searched">
- <xsl:param name="current.parent.fid" required="yes"/>
- <xsl:param name="grapht:fid" required="yes"/>
- <xsl:param name="grapht:path" select="1"/>
- <xsl:choose>
- <xsl:when test="descendant-or-self::*[@grapht:fid=$current.parent.fid ]"> <!-- descendant-or-self::*[@grapht:fid=$current.parent.fid ] --> <!-- key('descendant-or-self',$current.parent.fid) -->
- <xsl:for-each select="descendant::*[@grapht:fid=$current.parent.fid ][1]"> <!-- descendant::*[@grapht:fid=$current.parent.fid ][1] --> <!-- key('descendant-or-self',$current.parent.fid)[1] -->
- <grapht:path_step>
- <!--<xsl:copy-of select="@grapht:fid"/>-->
- <xsl:copy-of select="@p5:primaryKey"/>
- <xsl:attribute name="local-name" select="local-name()"/>
- </grapht:path_step>
- </xsl:for-each>
- <grapht:path_info>
- <xsl:attribute name="grapht:when" select="'descendant-or-self'"/>
- <xsl:attribute name="grapht:path" select="$grapht:path"/>
- <xsl:attribute name="grapht:node_from" select="@grapht:fid"/>
- </grapht:path_info>
- </xsl:when>
- <xsl:otherwise>
- <grapht:path_step>
- <!--<xsl:copy-of select="@grapht:fid"/>-->
- <xsl:copy-of select="@p5:primaryKey"/>
- <xsl:attribute name="local-name" select="local-name()"/>
- </grapht:path_step>
- <!--<xsl:message>#552 going parent to search by grapht:path=<xsl:value-of select="$grapht:path"/>;</xsl:message>-->
- <xsl:apply-templates mode="grapht:analyze_nodes.tree.clousure.searched" select="parent::node()">
- <xsl:with-param name="current.parent.fid" select="$current.parent.fid"/>
- <xsl:with-param name="grapht:fid" select="$grapht:fid"/>
- <xsl:with-param name="grapht:path" select="number($grapht:path) + 1"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- </xsl:stylesheet>
|