Model and Data Import Workflow
The wizard is started over the toolbar icon or Database > Model Baker > Import/Export Wizard.
To choose data files and models to import or generate a new database follow the description below. To generate a QGIS project from an existing database jump to the bottom of this guide. To export data from an existing database see the guide for that.
As well the Wizard opens when you drop a file to QGIS with the extension
xml only when it's dropped with a file having one of the other extensions).
First page offers you to select the sources to import.
Sources can be INTERLIS models stored in
ili files you select from your local system (with the file browser or with drag'n'drop).
As well you can search for INTERLIS models in the repositories or custom model directories. Since model names should be given strictly as they were spelled in INTERLIS files, once you start typing, autocompletion will help you discover available models with their correct spelling. Add them wiht the .
This leads you to a process to create the physical database in PostgreSQL, MSSQL or GeoPackage.
Transfer and Catalogue Files (Data Files)
xtf is an INTERLIS transfer file, containing spatial and/or alphanumeric data stored in XML format. Catalogues or Codelists are technically the same but have usually
xml as extension.
The selection of data files leads you to the process to import the data into a physical database.
In any case you are requested to set the connection to your database.
- Database Host Set the host of the database server. By default is localhost.
- Database Port Set the port of the database server. By default is 5432.
- Database Name Set the database name. The database should exist already.
- Database Schema The schema acts like a folder, it helps you to organize database objects like tables and relations and isolate them from other schemas. Set the database schema where you want to create the physical model or import the data from the transfer file to. You can even choose an existing schema where you create a new physical model, but you’d better know what you’re doing, because it will overwrite previous ili2db configurations.
- Database User Set the user to access the database.
- User Password Set the password for the database user.
- Execute data management tasks with superuser login from settings If checked, it uses the superuser login (set in the plugin configurations for data management tasks like the creation of the schema etc.
Import of INTERLIS Model
There are several ways the Model Baker wizard detects INTERLIS models to import.
- Read from the selected local
- Selected from the repositories.
- Parsed from the selected transfer or catalogue files.
- Depending model of a catalogue referenced in the ilidata.xml of the repositories.
- Defined as ili2db attribute in the metaconfiguration received from the UsabILIty Hub.
When you only got a model name (like in all cases except the one of the local
ini files) the models are searched in the repositories or custom model directories. It's possible that the models are listed multiple times coming from different sources. It's up to you what source you choose.
You can check or uncheck the models you want to import to a physical schema.
Metaconfiguration / Topping
Choose a metaconfiguration file found on the UsabILIty Hub to load ili2db settings and styling properties to your QGIS project.
Since Model Baker uses ili2db, you can set advanced options that determine how your conceptual object-oriented model is mapped into a physical model.
Ili2db allows you to use three types of inheritance mapping:
- noSmartMapping maps all classes from the source INTERLIS model into the target database schema. Each class maintains all its attributes. Model Baker does not provide this option in the settings.
- smart1inheritance prefers to create parent classes into the database, as long as they fulfill some specific requirements. Attributes from children classes will not be lost, since they are transferred into parent ones.
- smart2inheritance: prefers to create children classes into the database. Attribute from parent classes will not be lost, since they are transferred into children ones.
Create Basket Column
With this option you activate the Dataset and Basket Handling in your physical model.
When this option is checked, Model Baker passes
--createBasketCol to the ili2db command. Ili2db creates a new column
T_basket in class tables which references entries in the additional table
T_basket column needs to be filled with the basket to which an object belongs.
BASKET OID is defined in the model, it's required to use the basket handling in QGIS (we need to create the physical model the ili2db parameter
--createBasketCol). This is currently not automatically detected by the Model Baker and needs to be assured by the user.
When the dataset and basket handling is enabled, a default Dataset called
Baseset will be created and one basket per topic in the INTERLIS model.
If this option is activated, circular arcs are stroked when importing the data.
You can define
sql scripts that runs before and after the (schema) import.
Extra Meta Attribute File
ini file can contain values for meta attributes (like
dispExpression) instead of having them directly in the
Run ili2db Sessions
In the next step you can run all the sessions to create your physical model. If having multiple models selected that are received from the repositories, then they are passed in one command. You can run the commands one by one or all together.
With the button next to Run the options are provided to run the command without checking constraints or to edit the command manually before running it.
Import of INTERLIS Data
After the physial model is generated or you selected an existing database to import your transfer or catalogue files to containing the models already, you will see the page to set up your data imports.
While the order to import the INTERLIS models are not important (usually, see exceptions), the data import often requires the correct order. Transfer data often depends on existing catalogue / codelist data. Drag and drop your files with to the right order.
The Dataset and Basket Handling is only active, when the physical model has been created with Create Basket Column (
If so, the data are imported with the ili2db parameter
--update. This means that all the existing data in the same basket are updated (and removed if not existent in the transfer file).
Select the dataset you want to import your data to by double-click the dataset field. If you want to create a new dataset, use the dataset manager. The baskets are created during the import of the data.
If the data to import is a catalogue, please select the checkbox for catalogue and it will be imported into a dataset made for catalogues (called
Topping Transfer Data
Not only meta data for ili2db and styling can be received over the ilidata.xml from the UsabILIty Hub repositories. As well there can be found catalogue data referenced over the model name. This means Model Baker checks the UsabILIty Hub repositories for all the models contained in the database schema. If it founds referenced catalogue data it provides them to you in the autocomplete widget. Add them with the (the needed models have been suggested in the INTERLIS model import already).
Check more information about the catalogues on the UsabILIty Hub here.
Generate the QGIS Project
In case you want to generate your project from an existing database, you will need to set the connection parameters first.
Then, with a simple click you generate your project. All the toppings received from the UsabILIty Hub are considered here.