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

Set right basket in many-to-many association #876

Open signedav opened 9 months ago

signedav commented 9 months ago

When we have a many-to-many association it needs to be in a basket. Having multiple datasets leads to multiple possible baskets for it. When I create a new feature that is connected over the association, I can choose it's basket, but I can't choose it for the linking-feature.

Example

0. Having this model

INTERLIS 2.3;

/* Ortsplanung as national model */
MODEL WheresTheAssoc_V1 (en) AT "https://modelbaker.ch" VERSION "2024-02-07" =

  TOPIC Infrastruktur =
    CLASS Item =
          Text : TEXT;
    END Item;
  END Infrastruktur;

  TOPIC Unterhalt =
    DEPENDS ON WheresTheAssoc_V1.Infrastruktur;

    CLASS Instandsetzung =
          Text : TEXT;
    END Instandsetzung;

    ASSOCIATION InstandsetzungItemAssoc =
      Item (EXTERNAL) -- {0..*} WheresTheAssoc_V1.Infrastruktur.Item;
      Instandsetzung -- {0..*} Instandsetzung;
    END InstandsetzungItemAssoc;

  END Unterhalt;
END WheresTheAssoc_V1.

1. Having those baskets

2 datasets x 2 topics -> 4 baskets image

2. Create Item in TG

image

3. Create linked Instandsetzung in TG

Screenshot from 2024-02-08 15-53-24

But here we have the default basket selected in the Dataset Selector for "Baseset". We change to TG and store Screenshot from 2024-02-08 15-54-14

Result

The linking table has still the default basket, what is wrong.

image

Sollution

In this case here, where we have one link to an EXTERNAL class and one link to an internal class, it could be a solution to take always the basket of the internal parent:

image

But I neither have checked out if this solves it in every case (what if both parents are external?) nor I know if it could affect the performance too much....