Closed romefi closed 6 years ago
--exportModels
Do I understand that correctly that on Export, in case you have chosen the same XTF file like on import, the models is the same as on import as well?
You can create a database with multiple models inside and only export part of this.
The available models are listed in t_ili2db_models
( modelname up to the first {
)
They often looks like this CHAdminCodes_V1 AdministrativeUnits_V1{ CHAdminCodes_V1 InternationalCodes_V1 Dictionaries_V1 Localisation_V1 INTERLIS} AdministrativeUnitsCH_V1{ CHAdminCodes_V1 InternationalCodes_V1 LocalisationCH_V1 AdministrativeUnits_V1 INTERLIS}
so I assume not only up to the first {
but instead: CHAdminCodes_V1, AdministrativeUnits_V1 and AdministrativeUnitsCH_V1. Right?
Yes, you are right. The ones inside the curly braces are dependencies, maybe there is a smart way to automatically enable them along when something is activated?
After several tests I'm pretty sure that there is no difference if I choose one model or another or none. The t_ili2db_models
table always contains all from the chosen file. But I'll check if they are stored elsewhere...
Does by chance anyone have some appropriate test data for this use case? Eg. @zigertiger
Important use case: polymorphic export.
Nutzungsplanung: cantonal model (GL_Nutzungsplanung_V1_3) as an extension of federal model (Nutzungsplanung_LV95_V1_1). Export either according cantonal or federal model.
As m-kuhn mentioned, ili2db provides the option --exportmodels
for these cases.
1632-nup-20180809.zip
(at the moment, you need to import the data using the option --ver4-noSchemaImport
)
Hi @zigertiger
Since I'm not that experienced with these ili2pg command I have the question, how to import with the option --ver4-noSchemaImport
- because it gives me back --ver4-noSchemaImport: unknown option
.
Would your use case with thge cantonal and federal model lead to the command part like --models Nutzungsplanung_LV95_V1_1 --exportModels GL_Nutzungsplanung_V1_3
Means you have to be able to choose models and exportModels? Or should it be the same?
Hi @signedav At data import, ili2pg automatically imports additional model information that is not yet present in the schema. In most cases, this means imported models -- which are actually not needed since the data to be imported shall be conformant to the extended (cantonal) model.
In order to suppress ili2pg from importing additional model information, Claude introduced --ver4-noSchemaImport. Obviously, this option will no longer be needed in version 4 of ili2pg.
Export would in our case indeed make use of the --exportModels parameter. See our complete ili2pg commands attached.
Do you know from what version on this --ver4-noSchemaImport
option has been introduced?
I use the INTERLIS 2-loader for postgis, Version 3.11.2-20180208
- probably this has to be upgraded?
But anyway, that's only for testing.
Because we only talk about the command. At the moment, I make the import like this:
java -jar /home/david/dev/opengisch/projectgenerator/projectgenerator/libili2db/bin/ili2pg-3.11.2/ili2pg.jar --import --deleteData --coalesceCatalogueRef --createEnumTabs --createNumChecks --coalesceMultiSurface --coalesceMultiLine --coalesceMultiPoint --coalesceArray --strokeArcs --beautifyEnumDispName --createUnique --createGeomIdx --createFk --createFkIdx --createMetaInfo --importTid --smart1Inheritance --setupPgExt --dbhost 127.0.0.1 --dbport 5432 --dbusr postgres --dbpwd ****** --dbdatabase import --dbschema test_nup123
but it leads to space problems on my local machine at the moment.
So if you could tell me, what exactly has to be in the --model
and what in the --exportModel
on export it reduce my effort to find out.
Hey @gacarrillor can you help us on this issue?
At the moment on export we can have the option --models
- in the documentation it's written to use --exportModels
In the tests below I see no difference between 1 (using of --models
and --exportModels
) and 3 (using of --models
), and on 2 with only using --exportModels
it seems not to work.
So do you have an idea how this should be used?
java -jar /home/david/dev/opengisch/projectgenerator/projectgenerator/libili2db/bin/ili2pg-3.11.2/ili2pg.jar --export --exportModels CoordSys;Units --dbhost 127.0.0.1 --dbport 5432 --dbusr postgres --dbpwd ****** --dbdatabase import --dbschema test_nup --models CoordSys;Units /home/david/doc/clients/Schaffhausen/ws_projektgenerator/data/test_export_em.xtf
<?xml version="1.0" encoding="UTF-8"?><TRANSFER xmlns="http://www.interlis.ch/INTERLIS2.3">
<HEADERSECTION SENDER="ili2pg-3.11.2-20180208" VERSION="2.3"><MODELS><MODEL NAME="CoordSys" VERSION="2015-11-24" URI="http://www.interlis.ch/models"></MODEL><MODEL NAME="Units" VERSION="2012-02-20" URI="http://www.interlis.ch/models"></MODEL></MODELS></HEADERSECTION>
<DATASECTION>
</DATASECTION>
</TRANSFER>
exportModels without models
java -jar /home/david/dev/opengisch/projectgenerator/projectgenerator/libili2db/bin/ili2pg-3.11.2/ili2pg.jar --export --exportModels CoordSys;Units --dbhost 127.0.0.1 --dbport 5432 --dbusr postgres --dbpwd ****** --dbdatabase import --dbschema test_nup /home/david/doc/clients/Schaffhausen/ws_projektgenerator/data/test_export_e.xtf
Errormessage:
Info: lookup model <%XTF> in repository <jdbc:postgresql://127.0.0.1:5432/import/test_nup>
models without exportModels
java -jar /home/david/dev/opengisch/projectgenerator/projectgenerator/libili2db/bin/ili2pg-3.11.2/ili2pg.jar --export --dbhost 127.0.0.1 --dbport 5432 --dbusr postgres --dbpwd ****** --dbdatabase import --dbschema test_nup --models CoordSys;Units /home/david/doc/clients/Schaffhausen/ws_projektgenerator/data/test_export_m.xtf
<?xml version="1.0" encoding="UTF-8"?><TRANSFER xmlns="http://www.interlis.ch/INTERLIS2.3">
<HEADERSECTION SENDER="ili2pg-3.11.2-20180208" VERSION="2.3"><MODELS><MODEL NAME="CoordSys" VERSION="2015-11-24" URI="http://www.interlis.ch/models"></MODEL><MODEL NAME="Units" VERSION="2012-02-20" URI="http://www.interlis.ch/models"></MODEL></MODELS></HEADERSECTION>
<DATASECTION>
</DATASECTION>
</TRANSF
Grüezi @signedav You can check CHANGELOG.txt of any ili2db distribution (/docs/CHANGELOG.txt). --ver4-noSchemaImport was introduced in version 3.11.5 (2018-07-06).
For the documentation of program options, see https://github.com/claeis/ili2db/blob/master/docs/ili2db.rst
--models modelname: Namen des Modells (nicht zwingend identisch mit dem Dateinamen!), für das die Tabellenstruktur in der Datenbank erstellt werden soll. Mehrere Modellnamen können durch Semikolon ‚;‘ getrennt werden. Normalerweise muss der Namen nicht angegeben werden, und das Programm ermittelt den Wert automatisch aus den Daten. Wird beim --schemaimport nur eine ili-Datei als file angegeben, wird der Name des letzten Modells aus dieser ili-Datei als modelname genommen.
--exportModels modelname: Beim Export werden die Daten gem. dem gegebenen Basis-Modell exportiert. Ohne die Option --exportModels werden die Daten so wie sie erfasst sind, exportiert. Mehrere Modellnamen können durch Semikolon ‚;‘ getrennt werden.
The latter applies to extended models by inheritance (s. attachment)
Thanks @zigertiger Still confused. I guess it's because my lack of ili-knowledge. I'm sorry.
So let's assume there is a Federal_Model and a Cantonal_Model. The Cantonal_Model inherits from the Federal_Model. So there should be listed in the command: --exportModels Federal_Model
instead before --models Cantonal_Model;FederalModel
?
So first we should not use --models
but only --exportModels
instead and second we should only list the "parent"-models to export. Correct?
Otherwise we probably set better up a phone call, to talk clear swiss german :slightly_smiling_face:
--exportModels is only used at data export anyway (if specification in the context of extended models is relevant). Nevertheless, without --exportModels, you cannot export data according a base model (i.e. Federal_Model).
SO: the option --exportModels ist IMHO only needed if
but, to answer your questions: 1) YES. 2) NO. The general cause is export with --models. --exportModels ist rather a special cause (but not less important though).
Thanks @zigertiger and @m-kuhn
If possible use the one used chosen at schema import as default