opengisch / QgisModelBaker

Create QGIS projects from database schemas or Interlis models
https://opengisch.github.io/QgisModelBaker/
GNU Lesser General Public License v3.0
55 stars 17 forks source link

Dataimport Sessions: Error: dangling references #896

Open L-Hofman opened 8 months ago

L-Hofman commented 8 months ago

Hello! I have a question / a problem occuring during the Dataimport Session, which inhibits me from successfully importing a xtf. file.

Issues in first and second validation pass:

.... Info: first validation pass... Info: Basket Nutzungsplanung_LV95_V1_1.Geobasisdaten(oid BASKET1)... Info: Basket Nutzungsplanung_LV95_V1_1.TransferMetadaten(oid BASKET2)... Info: object count 4062 Error: unknown referenced object Nutzungsplanung_Hauptnutzung_V1_1.Hauptnutzung_CH.Hauptnutzung_CH TID ch.admin.are.nutzungsplanung.hauptnutzung_ch.71 referenced from Nutzungsplanung_LV95_V1_1.Geobasisdaten.Typ_Kt TID 5171 .... Info: second validation pass... ..... Info: validate AREA Nutzungsplanung_LV95_V1_1.Geobasisdaten.GrundnutzungZonenflaeche.Geometrie... **Error: failed to transfer data from file to db Error: dangling references ...replace failed Mit Fehlern beendet!**

Does anyone konw how to solve it?

Thank you so much!

Model Baker Issue
signedav commented 8 months ago

Looks like data are missing you require for your data (your data is referencing on it). Maybe https://models.geo.admin.ch/ARE/replaced/Hauptnutzung_CH_V1_1.xml

signedav commented 8 months ago

The screenshots look good. Is the data open? Can I have a look at the data file?

L-Hofman commented 8 months ago

Thank you! That did indeed solve the issue.

Now that I edited the data, there is a struggle occuring in the export. I added a new polygon to a layer. By default this new polygon has no t_ili_id assigned yet, as it is new. How can I assign it a valid t_ilid_id? All measures i tried (automatically generated / field calculator) did not work and led to this error message:

image

Therefore my question is: how can I generate a valid t_ili_id after adding a new polygon to my layer?

Thank you so much for your help.

signedav commented 8 months ago

It does not look like your t_ili_tid is wrong but instead that this object is not fulfilling constraint2:

!!@ cmsg="Wenn Rechtsstatus = laufende_Aenderung, dann muss Festsetzungstyp definiert sein";
    MANDATORY CONSTRAINT
       NOT (isEnumSubVal(Rechtsstatus,#laufende_Aenderung)) OR 
         DEFINED(Festsetzungstyp);

Maybe you can validate your data with the Model Baker Data Validator https://opengisch.github.io/QgisModelBaker/user_guide/validation/ so you can easily find your invalid object...