| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <?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"
- 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="debug.filter" select="'(9177)|(9177)'"/>
-
- <!--
- 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
-
-
-
- -->
-
- <!--
-
- 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:value-of select="concat( wfs:element($xlink:href),'.', wfs:primary_key($xlink:href))"/>
- </xsl:function>
-
- <xsl:template match="wfs:FeatureCollection" mode="grapht:analyze_nodes">
- <grapht:analyze_nodes>
- <xsl:for-each-group select=".//*[(*|@xlink:href) ]" 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])"/>
-
- <grapht:analyze_fid>
- <xsl:for-each-group select="current-group()[ matches(@p5:primaryKey,$debug.filter) ]" group-by="@fid">
- <xsl:for-each select="current-group()">
- <grapht:analyze_nodes.tree>
- <xsl:attribute name="fid" select="@fid"/>
- <!--<xsl:copy copy-namespaces="no">-->
- <!--<xsl:attribute name="fid" select="@fid"/>-->
- <grapht:analyze_nodes.tree.ancestors>
- <xsl:attribute name="grapht:parent.ancestor.count" select="count(ancestor::*)"/>
- <xsl:apply-templates mode="grapht:analyze_nodes.tree.ancestors" select="ancestor::*[*|@xlink:href]">
- <xsl:with-param name="grapht:parent.ancestor.count" select="count(ancestor::*)"/>
- </xsl:apply-templates>
- </grapht:analyze_nodes.tree.ancestors>
- <grapht:analyze_nodes.xlink.rebuild_tree_inputs>
- <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>
- </xsl:for-each>
- </xsl:for-each-group>
- </grapht:analyze_fid>
- </xsl:copy>
- </xsl:for-each-group>
- </grapht:analyze_nodes>
- </xsl:template>
-
- <xsl:template match="*" mode="grapht:analyze_nodes.tree.ancestors">
- <xsl:param name="grapht:parent.ancestor.count" required="yes"/>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:attribute name="grapht:ancestor.count" select="count(ancestor::*)"/>
- <xsl:attribute name="grapht:ancestor.path.len" select="$grapht:parent.ancestor.count - count(ancestor::*)"/>
- </xsl:copy>
- </xsl:template>
-
-
- <xsl:template match="*[not(@fid or @xlink:href)]" mode="grapht:analyze_nodes.tree.ancestors"/>
-
-
-
- <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:element>-->
- </xsl:copy>
- </xsl:template>
-
-
-
-
- <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:analyze_nodes.paths"/>
- </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:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:for-each-group select="grapht:analyze_nodes.tree" group-by="@fid">
- <xsl:variable name="current.parent.fid" select="@fid"/>
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.ancestors>
- <xsl:for-each-group select="current-group()/grapht:analyze_nodes.tree.ancestors/*" group-by="@fid">
- <xsl:sort select="@fid"/><!-- grapht:ancestor.path.len -->
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.ancestors.paths.to_childs>
- <xsl:for-each select="current-group()">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <grapht:analyze_nodes.tree.ancestors.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(@fid=$current.parent.fid)]/grapht:analyze_nodes.tree.ancestors/*[@fid= current()/@fid]">
- <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.ancestors.paths.to_childs.childs>
- </xsl:copy>
- </xsl:for-each>
- </grapht:analyze_nodes.tree.ancestors.paths.to_childs>
- </xsl:copy>
- </xsl:for-each-group>
- </grapht:analyze_nodes.tree.ancestors>
- </xsl:copy>
- </xsl:for-each-group>
- </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:stylesheet>
|