bcgtht.tree_to_dita.clousure.analys.merge.xsl 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:gml="http://www.opengis.net/gml"
  5. xmlns:p5bws="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/WPS_Functions.xsd"
  6. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  7. xmlns:bcgtht="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/bocian-graph-to-html/bcgtht.xsd"
  8. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:default_db__x3A__BI_audit_ENERGA_PRACOWNICY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_PRACOWNICY"
  10. xmlns:p5="https://biuro.biall-net.pl/wfs"
  11. 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"
  12. 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"
  13. xmlns:default_db__x3A__BI_audit_KRS="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS"
  14. xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI"
  15. xmlns:default_db__x3A__BI_audit_MSIG="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG"
  16. xmlns:default_db__x3A__BI_audit_CEIDG="https://biuro.biall-net.pl/wfs/default_db/BI_audit_CEIDG"
  17. xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
  18. xmlns:default_db__x3A__BI_audit_KRS_person="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS_person"
  19. xmlns:default_db__x3A__BI_audit_taxpayer="https://biuro.biall-net.pl/wfs/default_db/BI_audit_taxpayer"
  20. xmlns:default_db__x3A__BI_audit_KRS_company="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS_company"
  21. xmlns:default_db__x3A__BI_audit_MSIG_company="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_company"
  22. xmlns:default_db__x3A__TERYT_adresy="https://biuro.biall-net.pl/wfs/default_db/TERYT_adresy"
  23. xmlns:default_db__x3A__BI_audit_MSIG_person="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_person"
  24. xmlns:default_db__x3A__BI_audit_operational_raport_note="https://biuro.biall-net.pl/wfs/default_db/BI_audit_operational_raport_note"
  25. xmlns:default_db__x3A__BI_audit_MSIG_address="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_address"
  26. xmlns:p5yed="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/yed/p5yed.xsd"
  27. xmlns:p5suis="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/system_ui_info_speech/system_ui_info_speech.xsd"
  28. xmlns:math="http://exslt.org/math"
  29. xmlns:p5xmli="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/xmlschema_interface/p5xmli.xsd"
  30. extension-element-prefixes="math"
  31. version="2.0">
  32. <xsl:output indent="yes"/>
  33. <xsl:strip-space elements="*"/>
  34. <xsl:key name="path.clousure.following" match="path.clousure.following" use="@bcgtht:id"/>
  35. <xsl:key name="bcgtht:edge" match="bcgtht:edge" use="@bcgtht:id.edge"/>
  36. <xsl:key name="bcgtht:clousure.node.unique.descriptor.edge" match="/bcgtht:clousure.analys/path.clousure.following" use="bcgtht:edge[@bcgtht:id.edge] "/> <!-- parent::*/parent::*/@bcgtht:clousure.node,'|', --> <!-- [ parent::path.clousure.following[@bcgtht:clousure.from.len = '1']] -->
  37. <!-- taki sam id -->
  38. <xsl:key name="bcgtht:clousure.node.unique.descriptor.edge.other" match="/bcgtht:clousure.analys/path.clousure.following" use="1=1" > <!-- use="local-name()='path.clousure.following'" -->
  39. <!-- do wyszukania innych niz sami id -->
  40. </xsl:key>
  41. <!--<xsl:key name="bcgtht:clousure.node.unique.descriptor.edge.other_not" match="/bcgtht:clousure.analys/path.clousure.following" use="[ not(@bcgtht:id = current()/@bcgtht:id)]">
  42. <!-\- do wyszukania innych niz sami id -\->
  43. </xsl:key>-->
  44. <xsl:key name="bcgtht:clousure.node.unique.descriptor.edge.2" match="/bcgtht:clousure.analys/path.clousure.following" use="bcgtht:edge[@bcgtht:id.edge]"> <!-- and not(current()/@bcgtht:id = @bcgtht:id) -->
  45. <!--tested dziala do wyszukania innych niz sami -->
  46. </xsl:key>
  47. <!--<xsl:key name="bcgtht:clousure.node.unique.descriptor.same_id.same_edge.bypass" match="/bcgtht:clousure.analys/path.clousure.following" use="preceding-sibling::path.clousure.following[ bcgtht:edge[@bcgtht:id.edge] ]/generate-id()"> <!-\- bcgtht:edge[@bcgtht:id.edge] and not(current()/@bcgtht:id.edge = @bcgtht:id.edge) -\->
  48. <!-\- jak jest cos z moim id do jednej z moich krawedzi = bypass - to samo -\->
  49. </xsl:key>-->
  50. <xsl:key name="bcgtht:clousure.node.unique.descriptor.same_id.same_edge.bypass" match="/bcgtht:clousure.analys/path.clousure.following" use="bcgtht:edge[@bcgtht:id.edge] "> <!-- bcgtht:edge[@bcgtht:id.edge] and not(current()/@bcgtht:id.edge = @bcgtht:id.edge) -->
  51. <!-- NO CLEANUP jak jest cos z moim id do jednej z moich krawedzi = bypass - to samo -->
  52. </xsl:key>
  53. <!--<xsl:key name="bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass" match="/bcgtht:clousure.analys/path.clousure.following[ @bcgtht:clousure.node.pos = '0']" use="preceding-sibling::path.clousure.following[ bcgtht:edge[@bcgtht:id.edge] and @bcgtht:id]/generate-id()"> <!-\- bcgtht:edge[@bcgtht:id.edge] and not(current()/@bcgtht:id.edge = @bcgtht:id.edge) -\->
  54. <!-\- jak cos startuje i jest dowiazane do tej samej krawedzi = to samo -\->
  55. </xsl:key>-->
  56. <!--<xsl:key name="bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass" match="/bcgtht:clousure.analys/path.clousure.following[ @bcgtht:clousure.node.pos = '0']" use="bcgtht:edge[@bcgtht:id.edge]"> <!-\- bcgtht:edge[@bcgtht:id.edge] and not(current()/@bcgtht:id.edge = @bcgtht:id.edge) -\->
  57. <!-\- MUST CLEANUP jak cos startuje i jest dowiazane do tej samej krawedzi = to samo - wymaga czuysczenia -\->
  58. </xsl:key>-->
  59. <!--<xsl:key name="bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass" match="/bcgtht:clousure.analys/path.clousure.following[ @bcgtht:clousure.node.pos = '0']" use="bcgtht:edge[@bcgtht:id.edge] and ( count(bcgtht:edge) &gt; current()/count(bcgtht:edge) or ( count(bcgtht:edge) = current()/count(bcgtht:edge) and @bcgtht:id &gt; current()/@bcgtht:id ) ) "> <!-\- bcgtht:edge[@bcgtht:id] and not(current()/@bcgtht:id = @bcgtht:id) -\->
  60. <!-\- FULL jak cos startuje i jest dowiazane do tej samej krawedzi = to samo, bierzemy noda z najwieksza liczba edge oraz najwyzszym bcgtht:id -\->
  61. </xsl:key>-->
  62. <!--<xsl:key name="bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass" match="/bcgtht:clousure.analys/path.clousure.following/bcgtht:edge" use="@bcgtht:id"> <!-\- bcgtht:edge[@bcgtht:id.edge] and not(current()/@bcgtht:id = @bcgtht:id) -\->
  63. <!-\- TEST CLEANUP jak cos ma dwie krawedzie z roznych relacji takie do tego samego co ja (po czesci - ale z kazdej z nich) ma wiecej danych niz my lub wiekszy id -\->
  64. </xsl:key>-->
  65. <!--<xsl:key name="bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id" match="bcgtht:clousure.analys/path.clousure.following" use="not(current()/@bcgtht:id = @bcgtht:id) and ( count(bcgtht:edge) &gt; current()/count(bcgtht:edge) or ( count(bcgtht:edge) = current()/count(bcgtht:edge) and @bcgtht:id &gt; current()/@bcgtht:id ) )">
  66. <!-\-CLEANUP dodatkowy warunek do eliminacji slabszych wezlow - wiecej edge lub wiekszy id-\->
  67. </xsl:key>-->
  68. <!-- Merging bcgtht:clousure.node.unique.descriptor -->
  69. <!-- eliminujemy duble - sprawdzamy czy nasz wezel gdzies wystepuje -->
  70. <!-- chyba -->
  71. <!--<xsl:function name="bcgtht:clousure.node.unique.descriptor.edge.other">
  72. <xsl:param name="id"/>
  73. </xsl:function>-->
  74. <xsl:function name="bcgtht:clousure.node.unique.descriptor.edge.other">
  75. <xsl:param name="current"/>
  76. <!--<xsl:copy-of select="key('bcgtht:clousure.node.unique.descriptor.edge.other', 1=1)"/>-->
  77. <xsl:copy-of select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ not(@bcgtht:id = $current/@bcgtht:id)]"/>
  78. </xsl:function>
  79. <xsl:function name="bcgtht:clousure.node.unique.descriptor.edge.other.clean">
  80. <xsl:param name="path.clousure.following"/>
  81. <xsl:param name="current"/>
  82. <xsl:copy-of select="$path.clousure.following[not(@bcgtht:id = $current/@bcgtht:id) ]"/>
  83. </xsl:function>
  84. <!--<xsl:function name="bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass">
  85. <xsl:param name="path.clousure.following"/>
  86. <xsl:param name="current"/> <!-\- jak cos startuje i jest dowiazane do tej samej krawedzi = to samo -\->
  87. <!-\- bcgtht:edge[@bcgtht:id.edge] and ( count(bcgtht:edge) &gt; current()/count(bcgtht:edge) or ( count(bcgtht:edge) = current()/count(bcgtht:edge) and @bcgtht:id &gt; current()/@bcgtht:id ) ) -\->
  88. <xsl:copy-of select="$path.clousure.following[ count(bcgtht:edge) &gt; $current/count(bcgtht:edge) or ( count(bcgtht:edge) = $current/count(bcgtht:edge) and @bcgtht:id &gt; $current/@bcgtht:id ) ]"/>
  89. </xsl:function>-->
  90. <xsl:function name="bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass">
  91. <xsl:param name="current"/> <!-- jak cos startuje i jest dowiazane do tej samej krawedzi = to samo -->
  92. <!-- bcgtht:edge[@bcgtht:id.edge] and ( count(bcgtht:edge) &gt; current()/count(bcgtht:edge) or ( count(bcgtht:edge) = current()/count(bcgtht:edge) and @bcgtht:id &gt; current()/@bcgtht:id ) ) -->
  93. <xsl:copy-of select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ count(bcgtht:edge) &gt; $current/count(bcgtht:edge) or ( count(bcgtht:edge) = $current/count(bcgtht:edge) and @bcgtht:id &gt; $current/@bcgtht:id ) ]"/>
  94. </xsl:function>
  95. <xsl:function name="bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id">
  96. <xsl:param name="path.clousure.following"/>
  97. <xsl:param name="current"/> <!-- CLEANUP dodatkowy warunek do eliminacji slabszych wezlow - wiecej edge lub wiekszy id- -->
  98. <xsl:copy-of select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ not($current/@bcgtht:id = @bcgtht:id) and ( count(bcgtht:edge) &gt; $current/count(bcgtht:edge) or ( count(bcgtht:edge) = $current/count(bcgtht:edge) and @bcgtht:id &gt; $current/@bcgtht:id ) ) ]"/>
  99. </xsl:function>
  100. <xsl:function name="bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id">
  101. <!-- CLEANUP dodatkowy warunek do eliminacji slabszych wezlow - wiecej edge lub wiekszy id- -->
  102. <xsl:param name="current"/>
  103. <xsl:copy-of select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ not($current/@bcgtht:id = @bcgtht:id) and ( count(bcgtht:edge) &gt; $current/count(bcgtht:edge) or ( count(bcgtht:edge) = $current/count(bcgtht:edge) and @bcgtht:id &gt; $current/@bcgtht:id ) ) ]"/>
  104. </xsl:function>
  105. <xsl:function name="bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass">
  106. <xsl:param name="current"/> <!-- jak cos startuje i jest dowiazane do tej samej krawedzi = to samo -->
  107. <!-- TEST CLEANUP jak cos ma dwie krawedzie z roznych relacji takie do tego samego co ja (po czesci - ale z kazdej z nich) ma wiecej danych niz my lub wiekszy id -->
  108. <xsl:copy-of select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ @bcgtht:clousure.node.pos = '0' and bcgtht:edge[@bcgtht:id.edge = $current/bcgtht:edge/@bcgtht:id.edge] ]"/>
  109. </xsl:function>
  110. <xsl:function name="bcgtht:edge.prio_anal">
  111. <!-- im wyzsza liczba na wyjsciu , tym wiekszy priorytet postawienia noda -->
  112. <xsl:param name="bcgtht:edge.local.node"/>
  113. <xsl:param name="bcgtht:edge.remote.node"/>
  114. <!--<xsl:param name="bcgtht:id.local"/>
  115. <xsl:param name="bcgtht:id.remote"/>-->
  116. <xsl:variable name="out">
  117. <out>
  118. <edge>
  119. <xsl:choose>
  120. <xsl:when test="count($bcgtht:edge.local.node/*) &gt; count($bcgtht:edge.remote.node/*)"><xsl:attribute name="points" select="1"/></xsl:when>
  121. <xsl:otherwise><xsl:attribute name="points" select="-1"/></xsl:otherwise>
  122. </xsl:choose>
  123. </edge>
  124. <id>
  125. <xsl:choose>
  126. <xsl:when test="$bcgtht:edge.local.node/@bcgtht:id &gt; $bcgtht:edge.remote.node/@bcgtht:id"><xsl:attribute name="points" select="1"/></xsl:when>
  127. <xsl:otherwise><xsl:attribute name="points" select="0"/></xsl:otherwise>
  128. </xsl:choose>
  129. </id>
  130. <peer>
  131. <xsl:choose>
  132. <xsl:when test="$bcgtht:edge.local.node/@bcgtht:clousure.node.pos = '0'"><xsl:attribute name="points" select="1"/></xsl:when>
  133. </xsl:choose>
  134. <xsl:choose>
  135. <xsl:when test="$bcgtht:edge.remote.node/@bcgtht:clousure.node.pos = '0'"><xsl:attribute name="points" select="-1"/></xsl:when>
  136. </xsl:choose>
  137. </peer>
  138. <!--<id>
  139. <xsl:for-each-group select="$bcgtht:edge.local.node/bcgtht:edge" group-by="@bcgtht:edge.group"></xsl:for-each-group>
  140. <!-\-<xsl:choose>
  141. <xsl:when test="$bcgtht:edge.local.node/@bcgtht:id &gt; $bcgtht:edge.remote.node/@bcgtht:id"><xsl:attribute name="points" select="1"/></xsl:when>
  142. <xsl:otherwise><xsl:attribute name="points" select="0"/></xsl:otherwise>
  143. </xsl:choose>-\->
  144. </id>-->
  145. </out>
  146. </xsl:variable>
  147. <xsl:value-of select="sum($out//@points)"/>
  148. </xsl:function>
  149. <xsl:template mode="bcgtht:clousure.analys.merge" match="@*"/>
  150. <xsl:template mode="bcgtht:clousure.analys.merge" match="@bcgtht:id|@bcgtht:clousure.from|@bcgtht:clousure.node|@bcgtht:clousure.node.pos">
  151. <xsl:copy-of select="."/>
  152. </xsl:template>
  153. <xsl:function name="bcgtht:clousure.node.unique.descriptor.analys_vectors.sort">
  154. <xsl:param name="bcgtht:edge.local"/>
  155. <xsl:param name="bcgtht:edge.context"/>
  156. <xsl:choose>
  157. <xsl:when test="$bcgtht:edge.context[@bcgtht:id.edge = $bcgtht:edge.local/@bcgtht:id.edge]">
  158. <xsl:value-of select="1"/>
  159. </xsl:when>
  160. <xsl:otherwise><xsl:value-of select="0"/></xsl:otherwise>
  161. </xsl:choose>
  162. <!--<xsl:value-of select="$bcgtht:edge.context"/>-->
  163. </xsl:function>
  164. <xsl:function name="bcgtht:clousure.node.unique.descriptor.analys_vectors">
  165. <!-- do analizy danego noda co z nim zrobic itp -->
  166. <xsl:param name="current"/>
  167. <xsl:param name="bcgtht:edge.count.requested" /> <!-- glebokosc? -->
  168. <bcgtht:clousure.node.unique.descriptor.analys_vectors>
  169. <xsl:apply-templates mode="bcgtht:clousure.analys.merge" select="$current/@*"/>
  170. <xsl:for-each select="$current/bcgtht:edge">
  171. <LOCAL_EDGE>
  172. <xsl:variable name="bcgtht:edge" select="."/>
  173. <xsl:for-each select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ bcgtht:edge.prio_anal($current,.) &lt; 0 and not($current/@bcgtht:id = @bcgtht:id ) and bcgtht:edge[@bcgtht:id.edge = $bcgtht:edge/@bcgtht:id.edge ] ][ position() &lt; $bcgtht:edge.count.requested]">
  174. <xsl:sort select="bcgtht:clousure.node.unique.descriptor.analys_vectors.sort($bcgtht:edge,bcgtht:edge)" data-type="number" order="descending"/>
  175. <VECTOR_MAP>
  176. <xsl:apply-templates mode="bcgtht:clousure.analys.merge" select="@*"/>
  177. </VECTOR_MAP>
  178. </xsl:for-each>
  179. </LOCAL_EDGE>
  180. </xsl:for-each>
  181. </bcgtht:clousure.node.unique.descriptor.analys_vectors>
  182. </xsl:function>
  183. <xsl:function name="bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass">
  184. <!-- staramy sie nie pokazywac i znalezc powod do nie pokazania - jest nod ktory ma wyzszy priorytet i ma dwa podpiecia takie same -->
  185. <xsl:param name="current"/><!-- TODO jak cos ma dwie krawedzie z roznych relacji takie do tego samego co ja (po czesci - ale z kazdej z nich) ma wiecej danych niz my lub wiekszy id -->
  186. <xsl:param name="bcgtht:edge.count.requested" /> <!-- jakiego oczekujemy minimalnego warunku ilosci pasujacych wezlow -->
  187. <xsl:message>#147 todo incomplete bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass</xsl:message>
  188. <!--<xsl:copy-of select="$current/root()/bcgtht:clousure.analys/path.clousure.following/bcgtht:edge[ @bcgtht:clousure.node.pos = '0' and bcgtht:edge[@bcgtht:id.edge = $current/bcgtht:edge/@bcgtht:id.edge] ]"/>-->
  189. <bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass>
  190. <!--<xsl:copy-of select="$current/root()/bcgtht:clousure.analys/path.clousure.following/bcgtht:edge[ @bcgtht:id.edge = $current[bcgtht:edge[@bcgtht:id.edge] ] ]"/>-->
  191. <!--<xsl:call-template name="p5suis:say_to_queue.copy_file">
  192. <xsl:with-param name="text" select="'Likwidacja wezlow o takich samych cechach zakończeń. '"/>
  193. <xsl:with-param name="context" select="$current"/>
  194. <xsl:with-param name="unique-key" select="$current/@bcgtht:id"/>
  195. </xsl:call-template>-->
  196. <xsl:for-each select="$current/bcgtht:edge">
  197. <xsl:variable name="bcgtht:edge" select="."/>
  198. <LOCAL_bcgtht>
  199. <xsl:for-each select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ bcgtht:edge.prio_anal($current,.) &lt; 0 and not($current/@bcgtht:id = @bcgtht:id ) and bcgtht:edge[@bcgtht:id.edge = $bcgtht:edge/@bcgtht:id.edge ] ]" > <!-- group-by="@bcgtht:edge.group" -->
  200. <!--<xsl:sort select="concat(count(bcgtht:edge),$current/@bcgtht:id &gt; @bcgtht:id)"/>-->
  201. <!--<xsl:sort select="bcgtht:edge.prio_anal($current,.)"/>-->
  202. <PORT1>
  203. <xsl:copy-of select="@bcgtht:clousure.from"/>
  204. <xsl:copy-of select="@bcgtht:clousure.node"/>
  205. <xsl:copy-of select="@bcgtht:clousure.node.pos"/>
  206. <xsl:variable name="bcgtht:edge.prio_anal" select="bcgtht:edge.prio_anal($current,current())"/>
  207. <xsl:attribute name="bcgtht:edge.prio_anal" select="$bcgtht:edge.prio_anal"/>
  208. <!--<xsl:choose>
  209. <xsl:when test="$bcgtht:edge.prio_anal &gt; 0 "></xsl:when>
  210. </xsl:choose>-->
  211. <!-- trzeba sprawdzic, czy mamy podwojne zapiecia sa takie same - jak tylko jedna strona, to pokazujemy na mapie -->
  212. <xsl:for-each-group select="bcgtht:edge [ @bcgtht:id.edge = $bcgtht:edge/@bcgtht:id.edge and position() &gt;= $bcgtht:edge.count.requested ]" group-by="@bcgtht:edge.group"> <!-- [ and count( preceding-sibling::*) &gt; 1 @bcgtht:id = $bcgtht:edge/@bcgtht:id] -->
  213. <xsl:variable name="bcgtht:edge.remote.prio" select="@bcgtht:id.edge"/>
  214. <xsl:variable name="bcgtht:edge.local.prio" select="$bcgtht:edge/@bcgtht:id.edge"/>
  215. <xsl:variable name="bcgtht:edge.remote.count" select="count( current-group())"/>
  216. <PORT_LOCAL2>
  217. <xsl:attribute name="bcgtht:edge.pos" select="position()"/>
  218. <xsl:attribute name="p5suis:say.PL">#153 znalazlem taki sam koniec - liczyc trzeba wszystkie = <xsl:value-of select="@bcgtht:id.edge"/> dla node <xsl:value-of select="parent::path.clousure.following/@bcgtht:id"/> - (kontekstowy test od @bcgtht:id = <xsl:value-of select="$current/@bcgtht:id"/></xsl:attribute>
  219. <xsl:message>#153CCC znalazlem taki sam koniec - liczyc trzeba wszystkie = <xsl:value-of select="@bcgtht:id.edge"/> dla node <xsl:value-of select="parent::path.clousure.following/@bcgtht:id"/> - (kontekstowy test od @bcgtht:id = <xsl:value-of select="$current/@bcgtht:id"/></xsl:message>
  220. <xsl:comment>#153CCC znalazlem taki sam
  221. #153CCC znalazlem taki sam koniec - liczyc trzeba wszystkie = <xsl:value-of select="@bcgtht:id.edge"/> dla node <xsl:value-of select="parent::path.clousure.following/@bcgtht:id"/> - (kontekstowy test od @bcgtht:id = <xsl:value-of select="$current/@bcgtht:id"/></xsl:comment>
  222. <xsl:copy-of select="."/>
  223. </PORT_LOCAL2>
  224. </xsl:for-each-group>
  225. </PORT1>
  226. </xsl:for-each>
  227. <say>
  228. <xsl:attribute name="p5suis:say.PL">#152 will check czy jest dubel po koncach bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass</xsl:attribute>
  229. <xsl:message>#152 will check czy jest dubel po koncach bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass</xsl:message>
  230. </say>
  231. </LOCAL_bcgtht>
  232. </xsl:for-each>
  233. </bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass>
  234. </xsl:function>
  235. <xsl:template mode="bcgtht:clousure.analys.merge" match="bcgtht:clousure.analys">
  236. <xsl:message>#37 template mode="bcgtht:clousure.analys.merge"</xsl:message>
  237. <bcgtht:clousure.analys.merge>
  238. <xsl:copy-of select="p5xmli:xsi.schemaLocation($bcgtht.clousure.xsd,'http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/bocian-graph-to-html/bcgtht.xsd')"/>
  239. <xsl:apply-templates mode="bcgtht:clousure.analys.merge"/>
  240. </bcgtht:clousure.analys.merge>
  241. </xsl:template>
  242. <xsl:template mode="bcgtht:clousure.analys.merge" match="path.clousure.following">
  243. <xsl:variable name="bcgtht:clousure.analys.merge.current" select="."/>
  244. <xsl:message>#84 node <xsl:value-of select="bcgtht:edge/@bcgtht:id.edge"/></xsl:message>
  245. <xsl:copy>
  246. <xsl:copy-of select="@*"/>
  247. <!--<xsl:apply-templates mode="p5suis:add_group_raport_attributes" select=".">
  248. <xsl:with-param name="p5suis:lang" select="'PL'"/>
  249. </xsl:apply-templates>-->
  250. <!--
  251. <xsl:attribute name="p5suis:group.name" select="local-name()"/>
  252. <xsl:attribute name="p5suis:group.by">child::local-name()</xsl:attribute>
  253. <xsl:attribute name="p5suis:group-desc">child::local-name()</xsl:attribute>
  254. -->
  255. <xsl:if test="count(preceding-sibling::path.clousure.following) &lt; 10">
  256. <xsl:attribute name="bcgtht:clousure.node.unique.descriptor.edge" select="count(key('bcgtht:clousure.node.unique.descriptor.edge',bcgtht:edge))"/>
  257. <!--<xsl:attribute name="bcgtht:clousure.node.unique.descriptor.edge.other" select="count(key('bcgtht:clousure.node.unique.descriptor.edge.other',not(current()/@bcgtht:id = @bcgtht:id) ))"/>-->
  258. <xsl:attribute name="bcgtht:clousure.node.unique.descriptor.edge.other" select="count(bcgtht:clousure.node.unique.descriptor.edge.other( current()))"/>
  259. <xsl:attribute name="bcgtht:clousure.node.unique.descriptor.same_id.same_edge.bypass" select="count(key('bcgtht:clousure.node.unique.descriptor.same_id.same_edge.bypass',bcgtht:edge))"/>
  260. <xsl:attribute name="bcgtht:clousure.node.unique.descriptor.edge.2" select="count(bcgtht:clousure.node.unique.descriptor.edge.other.clean(key('bcgtht:clousure.node.unique.descriptor.edge.2',bcgtht:edge and not(current()/@bcgtht:id = @bcgtht:id)),current()))"/>
  261. <!--<xsl:attribute name="bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass" select="count(bcgtht:clousure.node.unique.descriptor.edge.other(key('bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass', bcgtht:edge),current()))"/>-->
  262. <xsl:attribute name="bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass" select="count( bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass( current()))"/>
  263. <!--<xsl:attribute name="bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id" select="count( bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id( key('bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id', not(current()/@bcgtht:id = @bcgtht:id) and ( count(bcgtht:edge) &gt; current()/count(bcgtht:edge) or ( count(bcgtht:edge) = current()/count(bcgtht:edge) and @bcgtht:id &gt; current()/@bcgtht:id ) )) ,current()))"/>-->
  264. <xsl:attribute name="bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id" select="count( bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id(current()))"/>
  265. <xsl:attribute name="bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass" select="count( bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass(current(),2))"/>
  266. <xsl:copy-of select="bcgtht:edge"/>
  267. <xsl:if test="1=2">
  268. <xsl:for-each select="key('bcgtht:clousure.node.unique.descriptor.edge',key('bcgtht:clousure.node.unique.descriptor.edge',bcgtht:edge))[position() &lt; 3]">
  269. <bcgtht:clousure.node.unique.descriptor.edge debug="###DDEEES taki sam id ? ">
  270. <xsl:copy-of select="."/>
  271. </bcgtht:clousure.node.unique.descriptor.edge>
  272. </xsl:for-each>
  273. <xsl:for-each select="bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id(current()) [position() &lt; 3]">
  274. <bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id debug="### FUNC CLEANED DD-GRRRTR-EEE-OID dodatkowy warunek do eliminacji slabszych wezlow - wiecej edge lub wiekszy id ">
  275. <xsl:copy-of select="."/>
  276. </bcgtht:clousure.node.unique.descriptor.more_edges_or_grtr_id>
  277. </xsl:for-each>
  278. <xsl:variable name="bcgtht:id" select="@bcgtht:id"/>
  279. <xsl:for-each select="bcgtht:clousure.node.unique.descriptor.edge.other( current())[ position() &lt; 3]">
  280. <bcgtht:clousure.node.unique.descriptor.edge.other debug="### OK DD-UU-EEE-OO do wyszukania innych niz sami - tylko id ">
  281. <xsl:message>#130 found bcgtht:clousure.node.unique.descriptor.edge.other OTHER = <xsl:value-of select="@bcgtht:id"/></xsl:message>
  282. <xsl:copy-of select="."/>
  283. </bcgtht:clousure.node.unique.descriptor.edge.other>
  284. </xsl:for-each>
  285. <!--<xsl:for-each select="key('bcgtht:clousure.node.unique.descriptor.edge.other_not', local-name() )[ position() &lt; 3]">
  286. <bcgtht:clousure.node.unique.descriptor.edge.other_not debug="###DD-UU-EEE-OO do wyszukania innych niz sami - tylko id ">
  287. <xsl:message>#135 found bcgtht:clousure.node.unique.descriptor.edge.other_not OTHER 22= <xsl:value-of select="@bcgtht:id"/></xsl:message>
  288. <xsl:copy-of select="."/>
  289. </bcgtht:clousure.node.unique.descriptor.edge.other_not>
  290. </xsl:for-each>-->
  291. <xsl:for-each select="bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass(current())[position() &lt; 3]">
  292. <bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass debug="##MID CLEANUP EEE-AAA-SSS-EEE-PP-000 krawedz 0 jak cos startuje i jest dowiazane do tej samej krawedzi = to samo, bierzemy noda z najwieksza liczba edge oraz najwyzszym bcgtht:id">
  293. <xsl:copy-of select="."/>
  294. </bcgtht:clousure.node.unique.descriptor.all_same_edge_pos_0.bypass>
  295. </xsl:for-each>
  296. <xsl:for-each select="bcgtht:clousure.node.unique.descriptor.edge.other.clean(key('bcgtht:clousure.node.unique.descriptor.edge.2',bcgtht:edge), current()) [ position() &lt; 3]"> <!-- key('bcgtht:clousure.node.unique.descriptor.edge.2',bcgtht:edge and not(current()/@bcgtht:id = @bcgtht:id)) [ position() &lt; 3] --> <!-- and not(current()/@bcgtht:id = @bcgtht:id) -->
  297. <bcgtht:clousure.node.unique.descriptor.edge.2 debug="## DEBUG TESTED dziala UUU-DD-OOO-T-SSS-N-ID--SSSEEEE do wyszukania innych niz sami not id, ale same edghe">
  298. <xsl:copy-of select="."/>
  299. </bcgtht:clousure.node.unique.descriptor.edge.2>
  300. </xsl:for-each>
  301. <xsl:for-each select="key('bcgtht:clousure.node.unique.descriptor.same_id.same_edge.bypass',bcgtht:edge)[position() &lt; 3]">
  302. <bcgtht:clousure.node.unique.descriptor.same_id.same_edge.bypass debug="# NO CLEANUP D-SSS-III-EEE-BBB jak jest cos z moim id do jednej z moich krawedzi = bypass - to samo">
  303. <xsl:copy-of select="."/>
  304. </bcgtht:clousure.node.unique.descriptor.same_id.same_edge.bypass>
  305. </xsl:for-each>
  306. <xsl:for-each select="bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass( current()) [ position() &lt; 3]">
  307. <bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass debug="### OK CLEANUP DDD-PPP-SSS-EEE-PPP-000 jak cos startuje i jest dowiazane do tej samej krawedzi = to samo">
  308. <xsl:copy-of select="."/>
  309. </bcgtht:clousure.node.unique.descriptor.prec_same_edge_pos_0.bypass>
  310. </xsl:for-each>
  311. </xsl:if>
  312. <!--<xsl:variable name="bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass">-->
  313. <!--<xsl:for-each select="bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass(current(),2)[position() &lt; 5]">
  314. <bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass debug="### TODO CCC_DDD_SS_BBBYS_EDGE jak cos ma dwie krawedzie z roznych relacji takie do tego samego co ja (po czesci - ale z kazdej z nich) ma wiecej danych niz my lub wiekszy id ">
  315. <xsl:attribute name="p5suis:say.PL">#153AAA znalazlem taki sam koniec - liczyc trzeba wszystkie <xsl:value-of select="@bcgtht:id"/> </xsl:attribute>
  316. <xsl:copy-of select="."/>
  317. </bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass>
  318. </xsl:for-each>-->
  319. <!--</xsl:variable>-->
  320. <!--<bcgtht:clousure.node.unique.descriptor.analys_vectors>
  321. <xsl:copy-of select="bcgtht:clousure.node.unique.descriptor.analys_vectors(.,4)"/>
  322. </bcgtht:clousure.node.unique.descriptor.analys_vectors>-->
  323. <xsl:variable name="current" select="."/>
  324. <bcgtht:clousure.node.unique.descriptor.analys_vectors>
  325. <xsl:apply-templates mode="bcgtht:clousure.analys.merge" select="$current/@*"/>
  326. <xsl:for-each select="$current/bcgtht:edge">
  327. <LOCAL_EDGE>
  328. <xsl:variable name="bcgtht:edge" select="."/>
  329. <xsl:for-each select="$current/root()/bcgtht:clousure.analys/path.clousure.following[ bcgtht:edge.prio_anal($current,.) &lt; 0 and not($current/@bcgtht:id = @bcgtht:id ) and key('bcgtht:edge',@bcgtht:id.edge ) ][ position() &lt; 5]"> <!-- bcgtht:edge[@bcgtht:id.edge = $bcgtht:edge/@bcgtht:id.edge ] -->
  330. <xsl:sort select="bcgtht:clousure.node.unique.descriptor.analys_vectors.sort($bcgtht:edge,bcgtht:edge)" data-type="number" order="descending"/>
  331. <VECTOR_MAP>
  332. <xsl:apply-templates mode="bcgtht:clousure.analys.merge" select="@*"/>
  333. </VECTOR_MAP>
  334. </xsl:for-each>
  335. </LOCAL_EDGE>
  336. </xsl:for-each>
  337. </bcgtht:clousure.node.unique.descriptor.analys_vectors>
  338. </xsl:if>
  339. <xsl:choose>
  340. <!-- czegi nie wyswietlamy? -->
  341. <!-- drugi raz tego samego id= ktore dotyka tej samej krawedzi -->
  342. <xsl:when test="bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass(current(),2)//PORT1[ @bcgtht:edge.prio_anal &lt; 0 ]/PORT_LOCAL2[@bcgtht:edge.pos='2']">
  343. <xsl:message>###374 bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass - merge nodes ? ingore</xsl:message>
  344. <bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass>
  345. <xsl:apply-templates mode="bcgtht:clousure.analys.merge" select="@*"/>
  346. <xsl:copy-of select="bcgtht:edge"/>
  347. </bcgtht:clousure.node.unique.descriptor.all_same_edge_both.bypass>
  348. </xsl:when>
  349. <xsl:when test="1=1">
  350. </xsl:when>
  351. <!-- priorytet takie same konce tylko jeden wezel taki -->
  352. </xsl:choose>
  353. <!--<xsl:choose>
  354. <xsl:when test="1 = 1 or key('bcgtht:clousure.node.unique.descriptor.edge.other', @bcgtht:id )">
  355. <bcgtht:clousure.node.unique.descriptor.edge.other count1="{ count(key('bcgtht:clousure.node.unique.descriptor.edge.other',@bcgtht:id ))}"
  356. count11="{ count(key('bcgtht:clousure.node.unique.descriptor.edge.other',$bcgtht:clousure.analys.merge.current/@bcgtht:id ))}"
  357. count_limited2="{ count(key('bcgtht:clousure.node.unique.descriptor.edge', bcgtht:edge [not( key('bcgtht:clousure.node.unique.descriptor.edge.other',$bcgtht:clousure.analys.merge.current/@bcgtht:id) ) ] ))}"
  358. count_limited_3="{ count(key('bcgtht:clousure.node.unique.descriptor.edge', bcgtht:edge))}"
  359. >
  360. </bcgtht:clousure.node.unique.descriptor.edge.other>
  361. </xsl:when>
  362. </xsl:choose>-->
  363. </xsl:copy>
  364. </xsl:template>
  365. <xsl:template mode="bcgtht:clousure.analys.merge" match="text()|comment()"/>
  366. </xsl:stylesheet>