Setting Prophet and ili2py Integration#171
Conversation
Some restructuring on the ili2db functions but keeping backwards compatibility (except the iliExcecutable, but should not be a problem, because it's usually derived (by IliImporter/IliExporter etc.) for the library usage
|
See the test cases to continue and think about: The goal of the SettingsProphet is to have a clean tooling box to get the info. But what if we need more (not settings specific) like enumeration values or visualize someting? There might be another Prophet-like-Class but do they have a common parent? |
|
Additional info to control the Library (not part of this PR, but maybe we need to be prepared for this use case on thinking about the structure): Receiving enumerationsAnd why Enumeration and not Library or BakerPyLibrary? See #153 Loading objectsInfo from the WS in Windisch: https://github.com/moflexch/awt5_windisch/tree/main/ws3_ili2py. How to load objects to QGIS
|
There was a problem hiding this comment.
Pull request overview
This PR adds an ili2c-based compilation path and introduces an ili2py “pythonizer” bridge plus prophet utilities (Model/SettingsProphet) to query model characteristics for downstream settings decisions, along with new tests and test models.
Changes:
- Add ili2c integration (
IliCompiler,Ili2CCommandConfiguration) and expose aIli2DbUtils.compile()helper that compiles.ilito.imd. - Add ili2py bridge utilities (
BakerPyIndex) and prophet classes (ModelProphet/SettingsProphet) with comprehensive QGIS-based tests. - Extend packaging to vendor ili2py (git clone) and additional Python deps (xsdata, typing-extensions), plus expand test model fixtures.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils.py | Adds an ili2c test configuration helper. |
| tests/test_compile.py | New test validating ili2c compilation output (IMD contents). |
| tests/test_pythonizer.py | New tests for BakerPyIndex index/library/enumeration helpers. |
| tests/test_model_prophet.py | New tests for SettingsProphet model capability queries. |
| tests/testdata/ilimodels/ArcInfrastruktur_V1.ili | New fixture model used in prophet tests. |
| tests/testdata/ilimodels/KT_ArcInfrastruktur_V1.ili | New fixture model extending topics (arcs/multi-geom scenarios). |
| tests/testdata/ilimodels/PianiDiUtilizzazione_V1_2.ili | New translation fixture model for language/translation detection. |
| scripts/package_pip_packages.sh | Vendors new Python deps and pulls ili2py from GitHub at a pinned commit. |
| modelbaker/utils/ili2db_utils.py | Adds compile() helper using ili2c (IliCompiler). |
| modelbaker/utils/db_utils.py | Adds helper to generate temporary .ili files from DB-stored model content. |
| modelbaker/utils/globals.py | Extends model blacklist with INTERLIS. |
| modelbaker/iliwrapper/iliexecutable.py | Refactors executable base to support both ili2db and ili2c entrypoints. |
| modelbaker/iliwrapper/ilicompiler.py | New IliCompiler wrapper using ili2c executable. |
| modelbaker/iliwrapper/ili2dbconfig.py | Adds Ili2CCommandConfiguration for ili2c args. |
| modelbaker/iliwrapper/ili2dbutils.py | Adds ili2c jar discovery/download + shared download helper. |
| modelbaker/iliwrapper/ili2dbtools.py | Adds ili2c download URL/version helpers. |
| modelbaker/iliwrapper/ilicache.py | Stores model “File” metadata and exposes it via item roles. |
| modelbaker/iliwrapper/iliimporter.py | Switches to Ili2DbExecutable base. |
| modelbaker/iliwrapper/iliexporter.py | Switches to Ili2DbExecutable base. |
| modelbaker/iliwrapper/ilideleter.py | Switches to Ili2DbExecutable base. |
| modelbaker/iliwrapper/iliupdater.py | Switches to Ili2DbExecutable base. |
| modelbaker/iliwrapper/ilivalidator.py | Switches to Ili2DbExecutable base. |
| modelbaker/iliwrapper/ilimetaconfigexporter.py | Switches to Ili2DbExecutable base. |
| modelbaker/ili2pytools/pythonizer.py | New BakerPyIndex (ili2py Index bridge) + convenience queries. |
| modelbaker/ili2pytools/model_prophet.py | New prophet utilities to derive model-based settings decisions. |
| modelbaker/ili2pytools/utils.py | New helper for generating meta-attrs temp files (currently buggy). |
| modelbaker/ili2pytools/init.py | Introduces ili2pytools package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9715aa9 to
ba5343f
Compare
ba5343f to
76036e2
Compare
Follow up of #160 - do not merge yet.
ili2py integration
ili2pytools.pythonizercontainingBakerPyIndexextending ili2pyIndexreading the metamodel from imd and inits itself. Then it is able to return library and enumeration object as well as having some convenience functions to get e.g. the classes filtered by the relevant topics etc.Model Prophet / Settings Prophet mplementation
Structure
Bestandteile
BakerPyIndex:Erbt
Indexund erhält imd file im init und erstellt sich selbst via reader damit. Er enthält einerseits funktionen um Library und Enumeration zurückzugeben sowie auch convenience Funktionen. Zbs:relevant_geometric_attributes_per_class, das mir die Geometriespalten per Klassenname zurückgibt und ich kann ihm auch eine blacklist der Modelle übergeben (wenn ich e.g. keine Basis-Modelle möchte) etc.ModelProphet:Eigentlich eine Util-Klasse:
BakerPyIndex + Model-Blacklist wird im init übergeben. Für Aussen ein Tool um alles abzufragen, was ich wissen möchte über das Modell. Heisst nicht mehr
SettingsProphetweil es nicht nur Infos für die Settings enthält, sondern vieeel mehr...SettingsProphet(ModelProphet)
utils.py
Evtl. auch als Klasse bauen und logfunction übergeben etc. Random utils zum Sachen bauen. Nutzt manchmal auch
ModelProphetoderPythonizeroder ili2py evtl. auch direkt. Aktuell drin wäre eine Funktion um ein TOML-File zu bauen (siehe Use Case unten). in Zukunft aber auch evtl. um UMLs zu bauen oder sogar Layer in QGIS laden (oder auch Daten)...Use Cases:
--createBasketColumnals Setting anbieten soll oder nicht? (wenn im Modell BASKET OID definiert ist es nämlich eh Pflicht): BaueBakerPyIndexund macheModelProphet(baker_py_index, model_blacklist).has_basket_oid_definition()Baue
BakerPyIndex, hole mir die Infos aus dem Prophet:ModelProphet(baker_py_index, model_blacklist).multi_geometry_structures_on_23()und übergebe die denutils.temp_meta_attr_file()BakerPyIndexund macheModelProphet(baker_py_index, model_blacklist).enumeration_values(attr_iliname)utils.uml_as_svg(BakerPy...weiss noch nicht genau wieutils.load_xtf(xtf, BakerPyLibrary...weiss noch nicht genau wie)Info
To run in Plugin this is needed opengisch/QgisModelBaker#1148
To dos
Little bit more extended and stretch goal:
Not part of this integration