wipo-gbd-transformation 1.1.105__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gbdtransformation/__init__.py +0 -0
- gbdtransformation/brands/__init__.py +44 -0
- gbdtransformation/brands/aetm/__init__.py +5 -0
- gbdtransformation/brands/aetm/filters.py +84 -0
- gbdtransformation/brands/aetm/schema +87 -0
- gbdtransformation/brands/aetm/template.yml +1 -0
- gbdtransformation/brands/aetm/tests/__init__.py +0 -0
- gbdtransformation/brands/altm/__init__.py +6 -0
- gbdtransformation/brands/altm/filters.py +107 -0
- gbdtransformation/brands/altm/schema +83 -0
- gbdtransformation/brands/altm/template.yml +1 -0
- gbdtransformation/brands/altm/tests/__init__.py +0 -0
- gbdtransformation/brands/altm/tests/altm.xml +93 -0
- gbdtransformation/brands/aptm/__init__.py +15 -0
- gbdtransformation/brands/aptm/filters.py +80 -0
- gbdtransformation/brands/aptm/schema +87 -0
- gbdtransformation/brands/aptm/template.yml +1 -0
- gbdtransformation/brands/aptm/tests/__init__.py +0 -0
- gbdtransformation/brands/attm/__init__.py +6 -0
- gbdtransformation/brands/attm/filters.py +76 -0
- gbdtransformation/brands/attm/schema +52 -0
- gbdtransformation/brands/attm/template.yml +85 -0
- gbdtransformation/brands/autm/__init__.py +2 -0
- gbdtransformation/brands/autm/filters.py +222 -0
- gbdtransformation/brands/autm/schema +91 -0
- gbdtransformation/brands/autm/template.yml +157 -0
- gbdtransformation/brands/bgtm/__init__.py +5 -0
- gbdtransformation/brands/bgtm/filters.py +112 -0
- gbdtransformation/brands/bgtm/schema +314 -0
- gbdtransformation/brands/bgtm/template.yml +154 -0
- gbdtransformation/brands/bhtm/__init__.py +12 -0
- gbdtransformation/brands/bhtm/filters.py +87 -0
- gbdtransformation/brands/bhtm/schema +87 -0
- gbdtransformation/brands/bhtm/template.yml +1 -0
- gbdtransformation/brands/bhtm/tests/__init__.py +0 -0
- gbdtransformation/brands/bntm/__init__.py +2 -0
- gbdtransformation/brands/bntm/filters.py +75 -0
- gbdtransformation/brands/bntm/schema +87 -0
- gbdtransformation/brands/bntm/template.yml +1 -0
- gbdtransformation/brands/bntm/tests/__init__.py +0 -0
- gbdtransformation/brands/brtm/__init__.py +3 -0
- gbdtransformation/brands/brtm/filters.py +169 -0
- gbdtransformation/brands/brtm/schema +86 -0
- gbdtransformation/brands/brtm/template.yml +22 -0
- gbdtransformation/brands/brtm/tests/__init__.py +0 -0
- gbdtransformation/brands/brtm/tests/test01.xml +53 -0
- gbdtransformation/brands/bttm/__init__.py +10 -0
- gbdtransformation/brands/bttm/filters.py +80 -0
- gbdtransformation/brands/bttm/schema +87 -0
- gbdtransformation/brands/bttm/template.yml +1 -0
- gbdtransformation/brands/bttm/tests/__init__.py +0 -0
- gbdtransformation/brands/bwtm/__init__.py +13 -0
- gbdtransformation/brands/bwtm/filters.py +90 -0
- gbdtransformation/brands/bwtm/schema +87 -0
- gbdtransformation/brands/bwtm/template.yml +1 -0
- gbdtransformation/brands/bwtm/tests/__init__.py +0 -0
- gbdtransformation/brands/bztm/__init__.py +16 -0
- gbdtransformation/brands/bztm/filters.py +77 -0
- gbdtransformation/brands/bztm/schema +87 -0
- gbdtransformation/brands/bztm/template.yml +1 -0
- gbdtransformation/brands/bztm/tests/__init__.py +0 -0
- gbdtransformation/brands/catm/__init__.py +10 -0
- gbdtransformation/brands/catm/filters.py +272 -0
- gbdtransformation/brands/catm/schema +804 -0
- gbdtransformation/brands/catm/template.yml +230 -0
- gbdtransformation/brands/chtm/__init__.py +6 -0
- gbdtransformation/brands/chtm/filters.py +161 -0
- gbdtransformation/brands/chtm/schema +79 -0
- gbdtransformation/brands/chtm/template.yml +121 -0
- gbdtransformation/brands/cltm/__init__.py +2 -0
- gbdtransformation/brands/cltm/filters.py +80 -0
- gbdtransformation/brands/cltm/schema +86 -0
- gbdtransformation/brands/cltm/template.yml +1 -0
- gbdtransformation/brands/cltm/tests/__init__.py +0 -0
- gbdtransformation/brands/crtm/__init__.py +5 -0
- gbdtransformation/brands/crtm/filters.py +196 -0
- gbdtransformation/brands/crtm/schema +86 -0
- gbdtransformation/brands/crtm/template.yml +1 -0
- gbdtransformation/brands/crtm/tests/__init__.py +0 -0
- gbdtransformation/brands/cutm/__init__.py +10 -0
- gbdtransformation/brands/cutm/filters.py +94 -0
- gbdtransformation/brands/cutm/schema +86 -0
- gbdtransformation/brands/cutm/template.yml +4 -0
- gbdtransformation/brands/cutm/tests/__init__.py +0 -0
- gbdtransformation/brands/detm/__init__.py +19 -0
- gbdtransformation/brands/detm/filters.py +75 -0
- gbdtransformation/brands/detm/schema +511 -0
- gbdtransformation/brands/detm/template.yml +151 -0
- gbdtransformation/brands/dktm/__init__.py +7 -0
- gbdtransformation/brands/dktm/filters.py +90 -0
- gbdtransformation/brands/dktm/schema +95 -0
- gbdtransformation/brands/dktm/template.yml +114 -0
- gbdtransformation/brands/dztm/__init__.py +10 -0
- gbdtransformation/brands/dztm/filters.py +81 -0
- gbdtransformation/brands/dztm/schema +87 -0
- gbdtransformation/brands/dztm/template.yml +1 -0
- gbdtransformation/brands/dztm/tests/__init__.py +0 -0
- gbdtransformation/brands/eetm/__init__.py +8 -0
- gbdtransformation/brands/eetm/filters.py +115 -0
- gbdtransformation/brands/eetm/schema +48 -0
- gbdtransformation/brands/eetm/template.yml +98 -0
- gbdtransformation/brands/egtm/__init__.py +5 -0
- gbdtransformation/brands/egtm/filters.py +73 -0
- gbdtransformation/brands/egtm/schema +87 -0
- gbdtransformation/brands/egtm/template.yml +1 -0
- gbdtransformation/brands/egtm/tests/__init__.py +0 -0
- gbdtransformation/brands/emtm/__init__.py +3 -0
- gbdtransformation/brands/emtm/filters.py +96 -0
- gbdtransformation/brands/emtm/schema +314 -0
- gbdtransformation/brands/emtm/template.yml +125 -0
- gbdtransformation/brands/estm/__init__.py +3 -0
- gbdtransformation/brands/estm/filters.py +110 -0
- gbdtransformation/brands/estm/schema +99 -0
- gbdtransformation/brands/estm/template.yml +144 -0
- gbdtransformation/brands/filters.py +125 -0
- gbdtransformation/brands/frtm/__init__.py +2 -0
- gbdtransformation/brands/frtm/filters.py +172 -0
- gbdtransformation/brands/frtm/schema +300 -0
- gbdtransformation/brands/frtm/template.yml +203 -0
- gbdtransformation/brands/gbtm/__init__.py +3 -0
- gbdtransformation/brands/gbtm/filters.py +122 -0
- gbdtransformation/brands/gbtm/schema +362 -0
- gbdtransformation/brands/gbtm/template.yml +147 -0
- gbdtransformation/brands/gdtm/__init__.py +5 -0
- gbdtransformation/brands/gdtm/filters.py +68 -0
- gbdtransformation/brands/gdtm/schema +87 -0
- gbdtransformation/brands/gdtm/template.yml +1 -0
- gbdtransformation/brands/gdtm/tests/__init__.py +0 -0
- gbdtransformation/brands/getm/__init__.py +3 -0
- gbdtransformation/brands/getm/filters.py +68 -0
- gbdtransformation/brands/getm/schema +209 -0
- gbdtransformation/brands/getm/template.yml +142 -0
- gbdtransformation/brands/ghtm/__init__.py +12 -0
- gbdtransformation/brands/ghtm/filters.py +74 -0
- gbdtransformation/brands/ghtm/schema +86 -0
- gbdtransformation/brands/ghtm/template.yml +1 -0
- gbdtransformation/brands/ghtm/tests/__init__.py +0 -0
- gbdtransformation/brands/gmtm/__init__.py +7 -0
- gbdtransformation/brands/gmtm/filters.py +70 -0
- gbdtransformation/brands/gmtm/schema +86 -0
- gbdtransformation/brands/gmtm/template.yml +1 -0
- gbdtransformation/brands/gmtm/tests/__init__.py +0 -0
- gbdtransformation/brands/gstm/__init__.py +2 -0
- gbdtransformation/brands/gstm/filters.py +75 -0
- gbdtransformation/brands/gstm/template.gs.yml +56 -0
- gbdtransformation/brands/gstm/template.yml +32 -0
- gbdtransformation/brands/hrtm/__init__.py +3 -0
- gbdtransformation/brands/hrtm/filters.py +158 -0
- gbdtransformation/brands/hrtm/schema +43 -0
- gbdtransformation/brands/hrtm/template.yml +205 -0
- gbdtransformation/brands/idtm/__init__.py +12 -0
- gbdtransformation/brands/idtm/filters.py +95 -0
- gbdtransformation/brands/idtm/schema +86 -0
- gbdtransformation/brands/idtm/template.yml +1 -0
- gbdtransformation/brands/idtm/tests/__init__.py +0 -0
- gbdtransformation/brands/idtm/tests/translation.xml +106 -0
- gbdtransformation/brands/idtm/tests/unicode.xml +120 -0
- gbdtransformation/brands/iltm/__init__.py +2 -0
- gbdtransformation/brands/iltm/filters.py +91 -0
- gbdtransformation/brands/iltm/schema +87 -0
- gbdtransformation/brands/iltm/template.yml +213 -0
- gbdtransformation/brands/iltm/tests/__init__.py +0 -0
- gbdtransformation/brands/iltm/tests/cancellations.xml +156 -0
- gbdtransformation/brands/iltm/tests/collcert.xml +51 -0
- gbdtransformation/brands/iltm/tests/eventdata.xml +83 -0
- gbdtransformation/brands/iltm/tests/international.xml +80 -0
- gbdtransformation/brands/iltm/tests/markfeature.xml +117 -0
- gbdtransformation/brands/iltm/tests/noevents.xml +44 -0
- gbdtransformation/brands/iltm/tests/opposition.xml +147 -0
- gbdtransformation/brands/iltm/tests/tlit.xml +77 -0
- gbdtransformation/brands/intm/__init__.py +6 -0
- gbdtransformation/brands/intm/filters.py +75 -0
- gbdtransformation/brands/intm/schema +127 -0
- gbdtransformation/brands/intm/template.yml +112 -0
- gbdtransformation/brands/ipas/__init__.py +0 -0
- gbdtransformation/brands/ipas/filters.py +203 -0
- gbdtransformation/brands/ipas/template.yml +185 -0
- gbdtransformation/brands/istm/__init__.py +10 -0
- gbdtransformation/brands/istm/filters.py +60 -0
- gbdtransformation/brands/istm/schema +53 -0
- gbdtransformation/brands/istm/template.yml +119 -0
- gbdtransformation/brands/ittm/__init__.py +6 -0
- gbdtransformation/brands/ittm/filters.py +114 -0
- gbdtransformation/brands/ittm/schema +104 -0
- gbdtransformation/brands/ittm/template.yml +107 -0
- gbdtransformation/brands/jotm/__init__.py +8 -0
- gbdtransformation/brands/jotm/filters.py +61 -0
- gbdtransformation/brands/jotm/schema +86 -0
- gbdtransformation/brands/jotm/template.yml +1 -0
- gbdtransformation/brands/jotm/tests/__init__.py +0 -0
- gbdtransformation/brands/jotm/tests/test.xml +84 -0
- gbdtransformation/brands/jptm/__init__.py +6 -0
- gbdtransformation/brands/jptm/filters.py +79 -0
- gbdtransformation/brands/jptm/schema +39 -0
- gbdtransformation/brands/jptm/template.yml +113 -0
- gbdtransformation/brands/ketm/__init__.py +9 -0
- gbdtransformation/brands/ketm/filters.py +77 -0
- gbdtransformation/brands/ketm/schema +86 -0
- gbdtransformation/brands/ketm/template.yml +1 -0
- gbdtransformation/brands/ketm/tests/__init__.py +0 -0
- gbdtransformation/brands/kgtm/__init__.py +6 -0
- gbdtransformation/brands/kgtm/filters.py +67 -0
- gbdtransformation/brands/kgtm/schema +27 -0
- gbdtransformation/brands/kgtm/template.yml +58 -0
- gbdtransformation/brands/khtm/__init__.py +14 -0
- gbdtransformation/brands/khtm/filters.py +134 -0
- gbdtransformation/brands/khtm/schema +86 -0
- gbdtransformation/brands/khtm/template.yml +1 -0
- gbdtransformation/brands/khtm/tests/__init__.py +0 -0
- gbdtransformation/brands/khtm/tests/khtm.xml +122 -0
- gbdtransformation/brands/krtm/__init__.py +6 -0
- gbdtransformation/brands/krtm/filters.py +136 -0
- gbdtransformation/brands/krtm/schema +179 -0
- gbdtransformation/brands/krtm/template.yml +186 -0
- gbdtransformation/brands/kwtm/__init__.py +2 -0
- gbdtransformation/brands/kwtm/filters.py +69 -0
- gbdtransformation/brands/kwtm/schema +86 -0
- gbdtransformation/brands/kwtm/template.yml +1 -0
- gbdtransformation/brands/kwtm/tests/__init__.py +0 -0
- gbdtransformation/brands/kwtm/tests/test.xml +84 -0
- gbdtransformation/brands/kztm/__init__.py +242 -0
- gbdtransformation/brands/kztm/filters.py +140 -0
- gbdtransformation/brands/kztm/schema +36 -0
- gbdtransformation/brands/kztm/template.yml +117 -0
- gbdtransformation/brands/latm/__init__.py +7 -0
- gbdtransformation/brands/latm/filters.py +93 -0
- gbdtransformation/brands/latm/schema +86 -0
- gbdtransformation/brands/latm/template.yml +1 -0
- gbdtransformation/brands/latm/tests/__init__.py +0 -0
- gbdtransformation/brands/latm/tests/test.xml +112 -0
- gbdtransformation/brands/lktm/__init__.py +5 -0
- gbdtransformation/brands/lktm/filters.py +83 -0
- gbdtransformation/brands/lktm/schema +87 -0
- gbdtransformation/brands/lktm/template.yml +1 -0
- gbdtransformation/brands/lktm/tests/__init__.py +0 -0
- gbdtransformation/brands/matm/__init__.py +3 -0
- gbdtransformation/brands/matm/filters.py +36 -0
- gbdtransformation/brands/matm/schema +33 -0
- gbdtransformation/brands/matm/template.yml +72 -0
- gbdtransformation/brands/mctm/__init__.py +3 -0
- gbdtransformation/brands/mctm/filters.py +65 -0
- gbdtransformation/brands/mctm/schema +128 -0
- gbdtransformation/brands/mctm/template.yml +122 -0
- gbdtransformation/brands/mdtm/__init__.py +3 -0
- gbdtransformation/brands/mdtm/filters.py +64 -0
- gbdtransformation/brands/mdtm/schema +128 -0
- gbdtransformation/brands/mdtm/template.yml +122 -0
- gbdtransformation/brands/metm/__init__.py +5 -0
- gbdtransformation/brands/metm/filters.py +87 -0
- gbdtransformation/brands/metm/schema +87 -0
- gbdtransformation/brands/metm/template.yml +1 -0
- gbdtransformation/brands/metm/tests/__init__.py +0 -0
- gbdtransformation/brands/mgtm/__init__.py +7 -0
- gbdtransformation/brands/mgtm/filters.py +73 -0
- gbdtransformation/brands/mgtm/schema +86 -0
- gbdtransformation/brands/mgtm/template.yml +1 -0
- gbdtransformation/brands/mgtm/tests/__init__.py +0 -0
- gbdtransformation/brands/mgtm/tests/test.xml +107 -0
- gbdtransformation/brands/mktm/__init__.py +6 -0
- gbdtransformation/brands/mktm/filters.py +63 -0
- gbdtransformation/brands/mktm/schema +80 -0
- gbdtransformation/brands/mktm/template.yml +112 -0
- gbdtransformation/brands/mntm/__init__.py +11 -0
- gbdtransformation/brands/mntm/filters.py +99 -0
- gbdtransformation/brands/mntm/schema +86 -0
- gbdtransformation/brands/mntm/template.yml +1 -0
- gbdtransformation/brands/mntm/tests/__init__.py +0 -0
- gbdtransformation/brands/mwtm/__init__.py +11 -0
- gbdtransformation/brands/mwtm/filters.py +80 -0
- gbdtransformation/brands/mwtm/schema +86 -0
- gbdtransformation/brands/mwtm/template.yml +1 -0
- gbdtransformation/brands/mwtm/tests/__init__.py +0 -0
- gbdtransformation/brands/mxtm/__init__.py +6 -0
- gbdtransformation/brands/mxtm/filters.py +77 -0
- gbdtransformation/brands/mxtm/schema +81 -0
- gbdtransformation/brands/mxtm/template.yml +127 -0
- gbdtransformation/brands/mytm/__init__.py +17 -0
- gbdtransformation/brands/mytm/filters.py +125 -0
- gbdtransformation/brands/mytm/schema +86 -0
- gbdtransformation/brands/mytm/template.yml +1 -0
- gbdtransformation/brands/mytm/tests/__init__.py +0 -0
- gbdtransformation/brands/mytm/tests/example.xml +132 -0
- gbdtransformation/brands/mytm/tests/mytm.xml +132 -0
- gbdtransformation/brands/mztm/__init__.py +14 -0
- gbdtransformation/brands/mztm/filters.py +89 -0
- gbdtransformation/brands/mztm/schema +86 -0
- gbdtransformation/brands/mztm/template.yml +1 -0
- gbdtransformation/brands/mztm/tests/__init__.py +0 -0
- gbdtransformation/brands/natm/__init__.py +11 -0
- gbdtransformation/brands/natm/filters.py +88 -0
- gbdtransformation/brands/natm/schema +86 -0
- gbdtransformation/brands/natm/template.yml +1 -0
- gbdtransformation/brands/natm/tests/__init__.py +0 -0
- gbdtransformation/brands/notm/__init__.py +5 -0
- gbdtransformation/brands/notm/filters.py +170 -0
- gbdtransformation/brands/notm/template.yml +289 -0
- gbdtransformation/brands/nztm/__init__.py +3 -0
- gbdtransformation/brands/nztm/filters.py +126 -0
- gbdtransformation/brands/nztm/schema +197 -0
- gbdtransformation/brands/nztm/template.yml +161 -0
- gbdtransformation/brands/oatm/__init__.py +18 -0
- gbdtransformation/brands/oatm/filters.py +82 -0
- gbdtransformation/brands/oatm/schema +87 -0
- gbdtransformation/brands/oatm/template.yml +1 -0
- gbdtransformation/brands/oatm/tests/__init__.py +0 -0
- gbdtransformation/brands/omtm/__init__.py +5 -0
- gbdtransformation/brands/omtm/filters.py +60 -0
- gbdtransformation/brands/omtm/schema +86 -0
- gbdtransformation/brands/omtm/template.yml +1 -0
- gbdtransformation/brands/omtm/tests/__init__.py +0 -0
- gbdtransformation/brands/omtm/tests/test.xml +84 -0
- gbdtransformation/brands/patm/__init__.py +8 -0
- gbdtransformation/brands/patm/filters.py +149 -0
- gbdtransformation/brands/patm/template.yml +40 -0
- gbdtransformation/brands/petm/__init__.py +6 -0
- gbdtransformation/brands/petm/filters.py +90 -0
- gbdtransformation/brands/petm/schema +114 -0
- gbdtransformation/brands/petm/template.yml +143 -0
- gbdtransformation/brands/pgtm/__init__.py +5 -0
- gbdtransformation/brands/pgtm/filters.py +76 -0
- gbdtransformation/brands/pgtm/schema +86 -0
- gbdtransformation/brands/pgtm/template.yml +1 -0
- gbdtransformation/brands/pgtm/tests/__init__.py +0 -0
- gbdtransformation/brands/pgtm/tests/pgtm.xml +128 -0
- gbdtransformation/brands/phtm/__init__.py +14 -0
- gbdtransformation/brands/phtm/filters.py +169 -0
- gbdtransformation/brands/phtm/schema +79 -0
- gbdtransformation/brands/phtm/schema.classic +50 -0
- gbdtransformation/brands/phtm/template.classic.yml +102 -0
- gbdtransformation/brands/phtm/template.yml +189 -0
- gbdtransformation/brands/pttm/__init__.py +0 -0
- gbdtransformation/brands/pttm/filters.py +0 -0
- gbdtransformation/brands/pttm/schema +0 -0
- gbdtransformation/brands/pttm/template.yml +0 -0
- gbdtransformation/brands/pytm/__init__.py +6 -0
- gbdtransformation/brands/pytm/filters.py +136 -0
- gbdtransformation/brands/pytm/template.yml +40 -0
- gbdtransformation/brands/qatm/__init__.py +5 -0
- gbdtransformation/brands/qatm/filters.py +81 -0
- gbdtransformation/brands/qatm/schema +87 -0
- gbdtransformation/brands/qatm/template.yml +1 -0
- gbdtransformation/brands/qatm/tests/__init__.py +0 -0
- gbdtransformation/brands/rotm/__init__.py +3 -0
- gbdtransformation/brands/rotm/filters.py +82 -0
- gbdtransformation/brands/rotm/schema +128 -0
- gbdtransformation/brands/rotm/template.yml +121 -0
- gbdtransformation/brands/rstm/__init__.py +5 -0
- gbdtransformation/brands/rstm/filters.py +88 -0
- gbdtransformation/brands/rstm/schema +86 -0
- gbdtransformation/brands/rstm/template.yml +1 -0
- gbdtransformation/brands/rstm/tests/__init__.py +0 -0
- gbdtransformation/brands/rutm/__init__.py +14 -0
- gbdtransformation/brands/rutm/filters.py +82 -0
- gbdtransformation/brands/rutm/schema +94 -0
- gbdtransformation/brands/rutm/template.yml +105 -0
- gbdtransformation/brands/sdtm/__init__.py +5 -0
- gbdtransformation/brands/sdtm/filters.py +59 -0
- gbdtransformation/brands/sdtm/schema +86 -0
- gbdtransformation/brands/sdtm/template.yml +1 -0
- gbdtransformation/brands/sdtm/tests/__init__.py +0 -0
- gbdtransformation/brands/sdtm/tests/test.xml +84 -0
- gbdtransformation/brands/sgtm/__init__.py +16 -0
- gbdtransformation/brands/sgtm/filters.py +177 -0
- gbdtransformation/brands/sgtm/schema +213 -0
- gbdtransformation/brands/sgtm/template.article6ter.yml +48 -0
- gbdtransformation/brands/sgtm/template.r13.yml +45 -0
- gbdtransformation/brands/sgtm/template.trademark.yml +148 -0
- gbdtransformation/brands/sgtm/template.yml +9 -0
- gbdtransformation/brands/smtm/__init__.py +6 -0
- gbdtransformation/brands/smtm/filters.py +77 -0
- gbdtransformation/brands/smtm/schema +86 -0
- gbdtransformation/brands/smtm/template.yml +1 -0
- gbdtransformation/brands/smtm/tests/__init__.py +0 -0
- gbdtransformation/brands/smtm/tests/test.xml +133 -0
- gbdtransformation/brands/solrjtm/__init__.py +1 -0
- gbdtransformation/brands/solrjtm/filters.py +85 -0
- gbdtransformation/brands/solrjtm/template.yml +195 -0
- gbdtransformation/brands/st66tm/__init__.py +1 -0
- gbdtransformation/brands/st66tm/filters.py +33 -0
- gbdtransformation/brands/st66tm/st66tm.tmpl +219 -0
- gbdtransformation/brands/sttm/__init__.py +18 -0
- gbdtransformation/brands/sttm/filters.py +72 -0
- gbdtransformation/brands/sttm/schema +83 -0
- gbdtransformation/brands/sttm/template.yml +1 -0
- gbdtransformation/brands/sttm/tests/__init__.py +0 -0
- gbdtransformation/brands/sztm/__init__.py +14 -0
- gbdtransformation/brands/sztm/filters.py +72 -0
- gbdtransformation/brands/sztm/schema +86 -0
- gbdtransformation/brands/sztm/template.yml +1 -0
- gbdtransformation/brands/sztm/tests/__init__.py +0 -0
- gbdtransformation/brands/thtm/__init__.py +2 -0
- gbdtransformation/brands/thtm/filters.py +86 -0
- gbdtransformation/brands/thtm/schema +86 -0
- gbdtransformation/brands/thtm/template.yml +175 -0
- gbdtransformation/brands/thtm/tests/__init__.py +0 -0
- gbdtransformation/brands/thtm/tests/test.xml +84 -0
- gbdtransformation/brands/tntm/__init__.py +16 -0
- gbdtransformation/brands/tntm/filters.py +89 -0
- gbdtransformation/brands/tntm/schema +87 -0
- gbdtransformation/brands/tntm/template.yml +1 -0
- gbdtransformation/brands/tntm/tests/__init__.py +0 -0
- gbdtransformation/brands/totm/__init__.py +5 -0
- gbdtransformation/brands/totm/filters.py +72 -0
- gbdtransformation/brands/totm/schema +86 -0
- gbdtransformation/brands/totm/template.yml +1 -0
- gbdtransformation/brands/totm/tests/__init__.py +0 -0
- gbdtransformation/brands/totm/tests/nofeature.xml +106 -0
- gbdtransformation/brands/totm/tests/syntax.xml +162 -0
- gbdtransformation/brands/totm/tests/test.xml +84 -0
- gbdtransformation/brands/tttm/__init__.py +17 -0
- gbdtransformation/brands/tttm/filters.py +79 -0
- gbdtransformation/brands/tttm/schema +87 -0
- gbdtransformation/brands/tttm/template.yml +1 -0
- gbdtransformation/brands/tttm/tests/__init__.py +0 -0
- gbdtransformation/brands/uatm/__init__.py +18 -0
- gbdtransformation/brands/uatm/filters.py +70 -0
- gbdtransformation/brands/uatm/schema +158 -0
- gbdtransformation/brands/uatm/template.yml +148 -0
- gbdtransformation/brands/ustm/__init__.py +187 -0
- gbdtransformation/brands/ustm/filters.py +227 -0
- gbdtransformation/brands/ustm/schema +2183 -0
- gbdtransformation/brands/ustm/template.yml +219 -0
- gbdtransformation/brands/uytm/__init__.py +3 -0
- gbdtransformation/brands/uytm/filters.py +64 -0
- gbdtransformation/brands/uytm/schema +106 -0
- gbdtransformation/brands/uytm/template.yml +137 -0
- gbdtransformation/brands/vctm/__init__.py +5 -0
- gbdtransformation/brands/vctm/filters.py +75 -0
- gbdtransformation/brands/vctm/schema +87 -0
- gbdtransformation/brands/vctm/template.yml +1 -0
- gbdtransformation/brands/vctm/tests/__init__.py +0 -0
- gbdtransformation/brands/vntm/__init__.py +9 -0
- gbdtransformation/brands/vntm/filters.py +84 -0
- gbdtransformation/brands/vntm/schema +86 -0
- gbdtransformation/brands/vntm/template.yml +1 -0
- gbdtransformation/brands/vntm/tests/__init__.py +0 -0
- gbdtransformation/brands/vutm/__init__.py +5 -0
- gbdtransformation/brands/vutm/filters.py +67 -0
- gbdtransformation/brands/vutm/schema +83 -0
- gbdtransformation/brands/vutm/template.yml +1 -0
- gbdtransformation/brands/vutm/tests/__init__.py +0 -0
- gbdtransformation/brands/whoinn/__init__.py +6 -0
- gbdtransformation/brands/whoinn/filters.py +46 -0
- gbdtransformation/brands/whoinn/schema +4 -0
- gbdtransformation/brands/whoinn/template.yml +45 -0
- gbdtransformation/brands/wo6ter/__init__.py +1 -0
- gbdtransformation/brands/wo6ter/filters.py +88 -0
- gbdtransformation/brands/wo6ter/template.yml +88 -0
- gbdtransformation/brands/woao/__init__.py +1 -0
- gbdtransformation/brands/woao/filters.py +107 -0
- gbdtransformation/brands/woao/schema +116 -0
- gbdtransformation/brands/woao/template.yml +90 -0
- gbdtransformation/brands/woptm/__init__.py +3 -0
- gbdtransformation/brands/woptm/filters.py +42 -0
- gbdtransformation/brands/woptm/template.yml +2 -0
- gbdtransformation/brands/wotm/__init__.py +3 -0
- gbdtransformation/brands/wotm/filters.py +127 -0
- gbdtransformation/brands/wotm/schema +218 -0
- gbdtransformation/brands/wotm/template.yml +220 -0
- gbdtransformation/brands/wstm/__init__.py +6 -0
- gbdtransformation/brands/wstm/filters.py +67 -0
- gbdtransformation/brands/wstm/schema +86 -0
- gbdtransformation/brands/wstm/template.yml +1 -0
- gbdtransformation/brands/wstm/tests/__init__.py +0 -0
- gbdtransformation/brands/wstm/tests/test.xml +132 -0
- gbdtransformation/brands/xxxx/__init__.py +6 -0
- gbdtransformation/brands/xxxx/filters.py +60 -0
- gbdtransformation/brands/xxxx/schema +4 -0
- gbdtransformation/brands/xxxx/template.yml +363 -0
- gbdtransformation/brands/zmtm/__init__.py +12 -0
- gbdtransformation/brands/zmtm/filters.py +79 -0
- gbdtransformation/brands/zmtm/schema +86 -0
- gbdtransformation/brands/zmtm/template.yml +1 -0
- gbdtransformation/brands/zmtm/tests/__init__.py +0 -0
- gbdtransformation/brands/zwtm/__init__.py +3 -0
- gbdtransformation/brands/zwtm/filters.py +86 -0
- gbdtransformation/brands/zwtm/schema +86 -0
- gbdtransformation/brands/zwtm/template.yml +1 -0
- gbdtransformation/brands/zwtm/tests/__init__.py +0 -0
- gbdtransformation/common/__init__.py +383 -0
- gbdtransformation/common/filters.py +418 -0
- gbdtransformation/common/jpap/__init__.py +1 -0
- gbdtransformation/common/jpap/filters.py +83 -0
- gbdtransformation/common/jpap/template.yml +37 -0
- gbdtransformation/common/jpbase/__init__.py +1 -0
- gbdtransformation/common/jpbase/filters.py +93 -0
- gbdtransformation/common/jpbase/template.yml +51 -0
- gbdtransformation/common/jprp/__init__.py +1 -0
- gbdtransformation/common/jprp/filters.py +86 -0
- gbdtransformation/common/jprp/template.yml +51 -0
- gbdtransformation/common/navigation.tmpl +12 -0
- gbdtransformation/commons/__init__.py +0 -0
- gbdtransformation/commons/emap/__init__.py +1 -0
- gbdtransformation/commons/emap/filters.py +16 -0
- gbdtransformation/commons/emap/template.yml +55 -0
- gbdtransformation/commons/emrp/__init__.py +1 -0
- gbdtransformation/commons/emrp/filters.py +14 -0
- gbdtransformation/commons/emrp/template.yml +53 -0
- gbdtransformation/commons/filters.py +3 -0
- gbdtransformation/designs/__init__.py +8 -0
- gbdtransformation/designs/alid/__init__.py +5 -0
- gbdtransformation/designs/alid/filters.py +69 -0
- gbdtransformation/designs/alid/schema +89 -0
- gbdtransformation/designs/alid/template.yml +1 -0
- gbdtransformation/designs/bnid/__init__.py +5 -0
- gbdtransformation/designs/bnid/filters.py +61 -0
- gbdtransformation/designs/bnid/schema +80 -0
- gbdtransformation/designs/bnid/template.yml +1 -0
- gbdtransformation/designs/bwid/__init__.py +6 -0
- gbdtransformation/designs/bwid/filters.py +64 -0
- gbdtransformation/designs/bwid/schema +101 -0
- gbdtransformation/designs/bwid/template.yml +1 -0
- gbdtransformation/designs/crid/__init__.py +5 -0
- gbdtransformation/designs/crid/filters.py +63 -0
- gbdtransformation/designs/crid/schema +94 -0
- gbdtransformation/designs/crid/template.yml +1 -0
- gbdtransformation/designs/cuid/__init__.py +5 -0
- gbdtransformation/designs/cuid/filters.py +60 -0
- gbdtransformation/designs/cuid/schema +98 -0
- gbdtransformation/designs/cuid/template.yml +1 -0
- gbdtransformation/designs/egid/__init__.py +5 -0
- gbdtransformation/designs/egid/filters.py +62 -0
- gbdtransformation/designs/egid/schema +82 -0
- gbdtransformation/designs/egid/template.yml +1 -0
- gbdtransformation/designs/filters.py +73 -0
- gbdtransformation/designs/idid/__init__.py +5 -0
- gbdtransformation/designs/idid/filters.py +67 -0
- gbdtransformation/designs/idid/schema +102 -0
- gbdtransformation/designs/idid/template.yml +1 -0
- gbdtransformation/designs/ipas/__init__.py +0 -0
- gbdtransformation/designs/ipas/filters.py +181 -0
- gbdtransformation/designs/ipas/template.yml +174 -0
- gbdtransformation/designs/joid/__init__.py +6 -0
- gbdtransformation/designs/joid/filters.py +62 -0
- gbdtransformation/designs/joid/schema +97 -0
- gbdtransformation/designs/joid/template.yml +1 -0
- gbdtransformation/designs/keid/__init__.py +5 -0
- gbdtransformation/designs/keid/filters.py +62 -0
- gbdtransformation/designs/keid/schema +99 -0
- gbdtransformation/designs/keid/template.yml +1 -0
- gbdtransformation/designs/khid/__init__.py +5 -0
- gbdtransformation/designs/khid/filters.py +63 -0
- gbdtransformation/designs/khid/schema +100 -0
- gbdtransformation/designs/khid/template.yml +1 -0
- gbdtransformation/designs/laid/__init__.py +5 -0
- gbdtransformation/designs/laid/filters.py +61 -0
- gbdtransformation/designs/laid/schema +94 -0
- gbdtransformation/designs/laid/template.yml +1 -0
- gbdtransformation/designs/mnid/__init__.py +6 -0
- gbdtransformation/designs/mnid/filters.py +62 -0
- gbdtransformation/designs/mnid/schema +98 -0
- gbdtransformation/designs/mnid/template.yml +1 -0
- gbdtransformation/designs/myid/__init__.py +5 -0
- gbdtransformation/designs/myid/filters.py +60 -0
- gbdtransformation/designs/myid/schema +95 -0
- gbdtransformation/designs/myid/template.yml +1 -0
- gbdtransformation/designs/phid/__init__.py +5 -0
- gbdtransformation/designs/phid/filters.py +70 -0
- gbdtransformation/designs/phid/schema +95 -0
- gbdtransformation/designs/phid/template.yml +1 -0
- gbdtransformation/designs/sgid/__init__.py +6 -0
- gbdtransformation/designs/sgid/filters.py +66 -0
- gbdtransformation/designs/sgid/schema +115 -0
- gbdtransformation/designs/sgid/template.yml +1 -0
- gbdtransformation/designs/thid/__init__.py +4 -0
- gbdtransformation/designs/thid/filters.py +64 -0
- gbdtransformation/designs/thid/schema +98 -0
- gbdtransformation/designs/thid/template.yml +1 -0
- gbdtransformation/designs/tnid/__init__.py +5 -0
- gbdtransformation/designs/tnid/filters.py +66 -0
- gbdtransformation/designs/tnid/schema +96 -0
- gbdtransformation/designs/tnid/template.yml +1 -0
- gbdtransformation/designs/vnid/__init__.py +5 -0
- gbdtransformation/designs/vnid/filters.py +62 -0
- gbdtransformation/designs/vnid/schema +97 -0
- gbdtransformation/designs/vnid/template.yml +1 -0
- gbdtransformation/designs/woid/__init__.py +2 -0
- gbdtransformation/designs/woid/filters.py +372 -0
- gbdtransformation/designs/woid/schema +592 -0
- gbdtransformation/designs/woid/template.yml +516 -0
- gbdtransformation/designs/xxid/__init__.py +2 -0
- gbdtransformation/designs/xxid/filters.py +60 -0
- gbdtransformation/designs/xxid/schema +4 -0
- gbdtransformation/designs/xxid/template.yml +358 -0
- gbdtransformation/execs-nico.py +709 -0
- gbdtransformation/execs.py +734 -0
- gbdtransformation/gbd-transform.exec.tgz +0 -0
- gbdtransformation/parser.py +190 -0
- gbdtransformation/renders.py +149 -0
- gbdtransformation/utilities/ISOCountryCodeType-V2006.xsd +1245 -0
- gbdtransformation/utilities/ISOCurrencyCodeType-V2001.xsd +855 -0
- gbdtransformation/utilities/ISOLanguageCodeType-V2002.xsd +715 -0
- gbdtransformation/utilities/WIPOST3CodeType-V2007.xsd +1151 -0
- gbdtransformation/utilities/__init__.py +0 -0
- gbdtransformation/utilities/st66.dot +2828 -0
- gbdtransformation/utilities/st66.pdf +0 -0
- gbdtransformation/utilities/st66.py +38700 -0
- gbdtransformation/utilities/st66.xsd +4174 -0
- schemas/ShazamConfig.py +35 -0
- schemas/__init__.py +0 -0
- schemas/schema_extractor.py +300 -0
- wipo_gbd_transformation-1.1.105.dist-info/LICENSE.md +687 -0
- wipo_gbd_transformation-1.1.105.dist-info/METADATA +25 -0
- wipo_gbd_transformation-1.1.105.dist-info/RECORD +607 -0
- wipo_gbd_transformation-1.1.105.dist-info/WHEEL +5 -0
- wipo_gbd_transformation-1.1.105.dist-info/entry_points.txt +6 -0
- wipo_gbd_transformation-1.1.105.dist-info/top_level.txt +2 -0
schemas/ShazamConfig.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
class ShazamConfig(object):
|
|
3
|
+
namespaceAliases = {}
|
|
4
|
+
matchIsLocalName = False
|
|
5
|
+
extension: str
|
|
6
|
+
extension_exclusion: str = None
|
|
7
|
+
docType: str
|
|
8
|
+
docSource: str
|
|
9
|
+
docNodeName: str = None
|
|
10
|
+
docNodeNames = []
|
|
11
|
+
|
|
12
|
+
def __init__(self, **entries):
|
|
13
|
+
self.__dict__.update(entries)
|
|
14
|
+
|
|
15
|
+
def matchPath(self, name):
|
|
16
|
+
return f"*[local-name() = '{name}'" if self.matchIsLocalName else name
|
|
17
|
+
|
|
18
|
+
def element(self, nName, eName):
|
|
19
|
+
return f"<xsl:element name='{eName}'><xsl:value-of select=\"{self.matchPath(nName)}\"/></xsl:element>"
|
|
20
|
+
|
|
21
|
+
def makeComplexLeaf(self, nName, parts):
|
|
22
|
+
if parts[1] == "for-each":
|
|
23
|
+
eName = parts[0]
|
|
24
|
+
e = self.element('.', eName)
|
|
25
|
+
return f"\t<xsl:for-each select=\"{self.matchPath(nName)}\">{e}</xsl:for-each>"
|
|
26
|
+
else:
|
|
27
|
+
return "\n\t".join([self.element(nName, eName) for eName in parts])
|
|
28
|
+
|
|
29
|
+
def nsAlias(self, namespace):
|
|
30
|
+
# print("asking for alias for " + namespace)
|
|
31
|
+
for alias in self.namespaceAliases.keys():
|
|
32
|
+
if self.namespaceAliases[alias] == namespace:
|
|
33
|
+
# print(namespace," -> ", alias)
|
|
34
|
+
return alias
|
|
35
|
+
return None
|
schemas/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
#! /usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
from xml.etree.ElementTree import fromstring, ElementTree, Element
|
|
4
|
+
import sys
|
|
5
|
+
import yaml
|
|
6
|
+
import os
|
|
7
|
+
import gzip
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from schemas.ShazamConfig import ShazamConfig
|
|
10
|
+
import re
|
|
11
|
+
|
|
12
|
+
YL = " "
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class CollectionPathsCounter:
|
|
16
|
+
def __init__(self):
|
|
17
|
+
self.paths_aggregates = {}
|
|
18
|
+
|
|
19
|
+
paths_aggregates = {}
|
|
20
|
+
# aggregate the counts of paths over the whole collection
|
|
21
|
+
# doc1 nice_path: 5
|
|
22
|
+
# doc2 nice_path: 1
|
|
23
|
+
# coll nice_paths: [5, 1]
|
|
24
|
+
# let's see where it crashes ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class DocCounter:
|
|
28
|
+
# one level
|
|
29
|
+
paths_counts = {}
|
|
30
|
+
paths_values = {}
|
|
31
|
+
|
|
32
|
+
def addEntry(self, nodePath, value):
|
|
33
|
+
path = make_path(nodePath)
|
|
34
|
+
# #### paths counts
|
|
35
|
+
if path in self.paths_counts:
|
|
36
|
+
self.paths_counts[path] += 1
|
|
37
|
+
else:
|
|
38
|
+
self.paths_counts[path] = 1
|
|
39
|
+
# #### paths values
|
|
40
|
+
if path in self.paths_values:
|
|
41
|
+
self.paths_values[path].append(value)
|
|
42
|
+
else:
|
|
43
|
+
self.paths_values[path] = [value]
|
|
44
|
+
|
|
45
|
+
def __str__(self):
|
|
46
|
+
toReturn = []
|
|
47
|
+
for path in self.paths_counts:
|
|
48
|
+
toReturn.append(f"{path} : {self.paths_counts[path]}")
|
|
49
|
+
return "\n".join(toReturn)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class SkellyNode:
|
|
53
|
+
""" Stores the aggregate skeleton of a document type"""
|
|
54
|
+
name = ""
|
|
55
|
+
# ## How to store the fact that the node can have 10 Nice or Vienna child nodes?
|
|
56
|
+
isMultiple = False # is that enough?
|
|
57
|
+
attributes = set()
|
|
58
|
+
children = dict()
|
|
59
|
+
namespace = None
|
|
60
|
+
namespaceAlias = None
|
|
61
|
+
parent = None
|
|
62
|
+
isRoot = False
|
|
63
|
+
|
|
64
|
+
def __init__(self, conf: ShazamConfig, parent, name, attributes):
|
|
65
|
+
if name.startswith("{"):
|
|
66
|
+
self.namespace = name[1:name.index("}")]
|
|
67
|
+
self.name = name[name.rindex("}") + 1:]
|
|
68
|
+
self.namespaceAlias = conf.nsAlias(self.namespace)
|
|
69
|
+
elif name.contains(":"):
|
|
70
|
+
self.namespace = name[0:name.rindex(":")]
|
|
71
|
+
self.name = name[name.rindex(":") + 1:]
|
|
72
|
+
self.namespaceAlias = conf.nsAlias(self.namespace)
|
|
73
|
+
else:
|
|
74
|
+
self.name = name
|
|
75
|
+
self.parent = parent
|
|
76
|
+
self.attributes = set(attributes) if attributes else set()
|
|
77
|
+
self.children = dict()
|
|
78
|
+
self.isMultiple = False
|
|
79
|
+
|
|
80
|
+
def add_attribute(self, attribute):
|
|
81
|
+
self.attributes.add(attribute)
|
|
82
|
+
|
|
83
|
+
def merge_attributes(self, attributes):
|
|
84
|
+
self.attributes.union(attributes)
|
|
85
|
+
|
|
86
|
+
def merge_child(self, child): # child should be a SkellyNode
|
|
87
|
+
# print("%%%% ", self)
|
|
88
|
+
if child.name in self.children.keys():
|
|
89
|
+
# print(f"==> {self.name} MERGE CHILD {child.name} WITH SIBLINGS ")
|
|
90
|
+
self.children[child.name].merge_with_sibling(child)
|
|
91
|
+
else:
|
|
92
|
+
self.children[child.name] = child
|
|
93
|
+
|
|
94
|
+
def adopt(self, child): # child should be a SkellyNode
|
|
95
|
+
# print("%%%% ", self)
|
|
96
|
+
if child.name in self.children.keys():
|
|
97
|
+
print(f"==> {self.name} MERGE CHILD {child.name} WITH SIBLINGS ")
|
|
98
|
+
raise ValueError("Should not adopt a child of the same name. Look at a merge function")
|
|
99
|
+
self.children[child.name] = child
|
|
100
|
+
|
|
101
|
+
def merge_with_sibling(self, node):
|
|
102
|
+
self.isMultiple = True # only merging with siblings of the same name
|
|
103
|
+
# print("MULTIPLE " + self.name)
|
|
104
|
+
if node.attributes:
|
|
105
|
+
self.attributes.union(node.attributes)
|
|
106
|
+
|
|
107
|
+
if node.children:
|
|
108
|
+
self.children.update(node.children)
|
|
109
|
+
|
|
110
|
+
def path(self):
|
|
111
|
+
ancestry = []
|
|
112
|
+
current = self
|
|
113
|
+
while current is not None and current.isRoot == False:
|
|
114
|
+
ancestry.insert(0, current.node_name())
|
|
115
|
+
current = current.parent
|
|
116
|
+
|
|
117
|
+
return make_path(ancestry)
|
|
118
|
+
|
|
119
|
+
def node_name(self):
|
|
120
|
+
if self.namespaceAlias:
|
|
121
|
+
return self.namespaceAlias + ":" + self.name
|
|
122
|
+
if self.namespace:
|
|
123
|
+
return self.namespace + ":" + self.name
|
|
124
|
+
return self.name
|
|
125
|
+
|
|
126
|
+
def __str__(self):
|
|
127
|
+
s = []
|
|
128
|
+
s.append("{" + (self.parent.name if self.parent else "GROOT") + "}")
|
|
129
|
+
s.append(f">{self.name}<")
|
|
130
|
+
s.append("[" + ("MULTIPLE" if self.isMultiple else "SINGLE") + "]")
|
|
131
|
+
|
|
132
|
+
if self.attributes:
|
|
133
|
+
s.append(" _@".join(self.attributes))
|
|
134
|
+
if self.children:
|
|
135
|
+
s.append("\n |_" + ("\n |_".join([c.name for c in self.children.values()])))
|
|
136
|
+
return " ".join(s)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def merge_trees(conf_local: ShazamConfig, sum_rec: SkellyNode, new_one: SkellyNode):
|
|
140
|
+
if sum_rec is None:
|
|
141
|
+
return new_one
|
|
142
|
+
sum_rec.merge_attributes(new_one.attributes)
|
|
143
|
+
sum_rec.isMultiple = sum_rec.isMultiple or new_one.isMultiple
|
|
144
|
+
next_children = {}
|
|
145
|
+
for childName in sum_rec.children.keys():
|
|
146
|
+
# print(f"{childName} in sumRec: {childName in sumRec.children.keys()}")
|
|
147
|
+
if childName in new_one.children.keys():
|
|
148
|
+
# print(f"{childName} in sumRec: {childName in sumRec.children.keys()}")
|
|
149
|
+
# print(f"{childName} in newOne : {childName in newOne.children.keys()}")
|
|
150
|
+
new_child = merge_trees(conf_local, sum_rec.children[childName], new_one.children[childName])
|
|
151
|
+
next_children[childName] = new_child
|
|
152
|
+
else:
|
|
153
|
+
next_children[childName] = sum_rec.children[childName]
|
|
154
|
+
sum_rec.children = next_children
|
|
155
|
+
for childName in new_one.children:
|
|
156
|
+
if childName not in sum_rec.children:
|
|
157
|
+
sum_rec.adopt(new_one.children[childName])
|
|
158
|
+
return sum_rec
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def make_path(ancestry):
|
|
162
|
+
return "/".join(ancestry)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def print_skel(skel, level, out):
|
|
166
|
+
root = "# ROOT" if skel.isRoot else ""
|
|
167
|
+
multi = "# Multiple" if skel.isMultiple else "" # "# Single"
|
|
168
|
+
path = skel.path()
|
|
169
|
+
print(f"{level}{skel.node_name()}: {root} {multi} # {path}", file=out)
|
|
170
|
+
for attr in skel.attributes:
|
|
171
|
+
print(f"{level}{YL}_@{attr}: # {path}@{attr}", file=out)
|
|
172
|
+
# if skel.namespace:
|
|
173
|
+
# print(f"{level}{YL}namespace: {skel.namespace}", file=out)
|
|
174
|
+
for child in skel.children:
|
|
175
|
+
# print(":::" , child)
|
|
176
|
+
print_skel(skel.children[child], level + YL, out)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def build_skel(conf_local: ShazamConfig, parent, node: Element):
|
|
180
|
+
# print("## New Skeleton Node [" + node.tag + "] parent: {" + (parent.name if parent else "None") + "}")
|
|
181
|
+
localSkel = SkellyNode(conf_local, parent, node.tag, node.keys())
|
|
182
|
+
if parent is None:
|
|
183
|
+
localSkel.isRoot = True
|
|
184
|
+
if len(node.keys()) > 0:
|
|
185
|
+
localSkel.merge_attributes(node.keys())
|
|
186
|
+
for child in node:
|
|
187
|
+
# print ("$$$ " + child.tag)
|
|
188
|
+
localSkel.merge_child(build_skel(conf_local, localSkel, child))
|
|
189
|
+
return localSkel
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def print_paths(accumulator, node, parents):
|
|
193
|
+
if len(node) == 0:
|
|
194
|
+
currentPath = []
|
|
195
|
+
currentPath.extend(parents)
|
|
196
|
+
currentPath.append(node.tag)
|
|
197
|
+
|
|
198
|
+
print(make_path(currentPath), "::", node.text)
|
|
199
|
+
accumulator.addEntry(currentPath, node.text)
|
|
200
|
+
## Attributes
|
|
201
|
+
if len(node.keys()) == 0:
|
|
202
|
+
return
|
|
203
|
+
for attr in node.keys():
|
|
204
|
+
accumulator.addEntry(currentPath + ["@" + attr], node.get(attr))
|
|
205
|
+
# print(make_path(currentPath + ["@" + attr]), node.get(attr))
|
|
206
|
+
else:
|
|
207
|
+
parent_tmp = parents + [node.tag]
|
|
208
|
+
for child in node:
|
|
209
|
+
print_paths(accumulator, child, parent_tmp)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# def header(docType, docSource, rootName, matchIsLocalName):
|
|
213
|
+
# return f"""config:
|
|
214
|
+
# docType: {docType}
|
|
215
|
+
# docSource: {docSource}
|
|
216
|
+
# rootName: {rootName}
|
|
217
|
+
# matchIsLocalName: {matchIsLocalName}
|
|
218
|
+
#
|
|
219
|
+
# """
|
|
220
|
+
#
|
|
221
|
+
def parse_file(local_conf: ShazamConfig, source: str):
|
|
222
|
+
text: str = None
|
|
223
|
+
if source.endswith(".xml.gz"):
|
|
224
|
+
with gzip.open(source, "rb") as gz:
|
|
225
|
+
text = gz.read()
|
|
226
|
+
else:
|
|
227
|
+
with open(source, "r") as f:
|
|
228
|
+
text = f.read()
|
|
229
|
+
return parse_entries(local_conf, text)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def parse_entries(local_conf: ShazamConfig, text: str):
|
|
233
|
+
tree = ElementTree(fromstring(text))
|
|
234
|
+
root: Element = tree.getroot()
|
|
235
|
+
|
|
236
|
+
# < BaseXML >
|
|
237
|
+
# < U_ID >
|
|
238
|
+
# < id > 43057 < / id >
|
|
239
|
+
accumulator_record = None
|
|
240
|
+
records = []
|
|
241
|
+
|
|
242
|
+
if local_conf.docNodeName is None and len(local_conf.docNodeNames) == 0:
|
|
243
|
+
records = root
|
|
244
|
+
elif local_conf.docNodeName:
|
|
245
|
+
records = [n for n in root.iter(local_conf.docNodeName)]
|
|
246
|
+
elif len(local_conf.docNodeNames):
|
|
247
|
+
for doc_node_name in conf.docNodeNames:
|
|
248
|
+
tmp = [n for n in root.iter(doc_node_name)]
|
|
249
|
+
if len(tmp) > 0:
|
|
250
|
+
print("(%s)" % doc_node_name)
|
|
251
|
+
records.extend(tmp)
|
|
252
|
+
|
|
253
|
+
for record in records: # xml.etree.ElementTree.Element
|
|
254
|
+
# print(record)
|
|
255
|
+
current_record = build_skel(local_conf, None, record)
|
|
256
|
+
# printPaths(accumulator, mark, [""])
|
|
257
|
+
# print("########### 11 ############")
|
|
258
|
+
# print_skel(currentRecord, "", sys.stdout)
|
|
259
|
+
accumulator_record = merge_trees(local_conf, accumulator_record, current_record)
|
|
260
|
+
# sys.exit()
|
|
261
|
+
# print(accumulator)
|
|
262
|
+
return accumulator_record
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
if __name__ == "__main__":
|
|
266
|
+
conf_yaml = sys.argv[1]
|
|
267
|
+
name = sys.argv[2]
|
|
268
|
+
source = sys.argv[3]
|
|
269
|
+
destination = sys.argv[4]
|
|
270
|
+
conf = None
|
|
271
|
+
with open(conf_yaml, 'r') as y:
|
|
272
|
+
schema_template = yaml.safe_load(y)
|
|
273
|
+
conf = ShazamConfig(**schema_template.pop(name))
|
|
274
|
+
|
|
275
|
+
# source = '/ssd/hoibian/workspace/bnd-defs/xml-schemas/kztm/gb_export_test.xml'
|
|
276
|
+
# destination = "/ssd/hoibian/workspace/bnd-defs/xml-schemas/kztm/skeleton.yaml"
|
|
277
|
+
print("Gonna parse", source)
|
|
278
|
+
print("Saving to ", destination)
|
|
279
|
+
|
|
280
|
+
accumulatorRecord = None
|
|
281
|
+
|
|
282
|
+
if os.path.isfile(source):
|
|
283
|
+
full_text = None
|
|
284
|
+
accumulatorRecord = parse_file(source)
|
|
285
|
+
elif os.path.isdir(source):
|
|
286
|
+
for path in Path(source).rglob("*"+conf.extension):
|
|
287
|
+
# print(path.name)
|
|
288
|
+
# if conf.extension_exclusion is None or not re.match(conf.extension_exclusion, path.name):
|
|
289
|
+
# print(conf.extension_exclusion, path.name)
|
|
290
|
+
|
|
291
|
+
if conf.extension_exclusion is None or not re.match(conf.extension_exclusion, path.name):
|
|
292
|
+
print("==>", path, path.name)
|
|
293
|
+
tmp = parse_file(conf, str(path))
|
|
294
|
+
accumulatorRecord = merge_trees(conf, accumulatorRecord, tmp)
|
|
295
|
+
print("########### 22 ############")
|
|
296
|
+
|
|
297
|
+
with open(destination, 'w') as y:
|
|
298
|
+
yaml.dump(conf, y)
|
|
299
|
+
y.write("\n\n")
|
|
300
|
+
print_skel(accumulatorRecord, "", y)
|